source: proiecte/pgraph/Code/Dijkstra/generate2.c @ 129

Last change on this file since 129 was 129, checked in by (none), 14 years ago
File size: 389 bytes
Line 
1//Author Antonio-Gabriel Sturzu
2
3#include<stdio.h>
4
5int main()
6{
7        int n,i,j,val;
8        FILE *f=fopen("dijkstra.in","r");
9        FILE *g=fopen("dijkstra2.in","w");
10
11        fscanf(f,"%i",&n);
12        fprintf(g,"%i %i\n",n,n*(n-1));
13        for(i=0;i<n;i++)
14                for(j=0;j<n;j++)
15                {
16                        fscanf(f,"%i",&val);
17                        if(val>0)
18                                fprintf(g,"%i %i %i\n",i+1,j+1,val);
19                }
20        fclose(f);
21        fclose(g);
22        return 0;
23}
Note: See TracBrowser for help on using the repository browser.