source: proiecte/pgraph/Code/Prim/agenerate2.c @ 129

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