#include<stdio.h>
FILE *f1,*f2;
long n,m,flag[1000][1000];
long u,v;
void nhap_DSC(){
f1=fopen("VHKTS_DSC.inp","r");
fscanf(f1,"%d",&n);
fscanf(f1,"%d",&m);
//khoi tao
for(long i=1;i<=n;i++)
for(long j=1;j<=n;j++)
flag[i][j]=0;
//doc du lieu
for(long i=1;i<=m;i++){
fscanf(f1,"%d%d",&u,&v);
flag[u][v]=flag[v][u]=1;
}
fclose(f1);
}
void xuat_MTK(){
f2=fopen("VHKTS_MTK.out","w");
//xuat ma tran ke
for(long i=1;i<=n;i++){
for(long j=1;j<=n;j++){
fprintf(f2,"%d ",flag[i][j]);
}
fprintf(f2,"\n");
}
fclose(f2);
}
int main(){
nhap_DSC();
xuat_MTK();
return 0;
}
Tags:
DevC