Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C by fargo ( 15 years ago )
#include<stdio.h>
#include<stdlib.h>
//#define MAX_SPIDERS 100
#define MAX_BEADS 100
struct spiders
{
int thread[MAX_BEADS];
};
int main()
{
int spidersnum, beads,bead_a,bead_b,i,*threadsnum;
struct spiders spider[MAX_BEADS];
FILE *fp;
fp=fopen("input.txt","r");
fscanf(fp,"%d",&spidersnum;);
fscanf(fp,"%d",&beads;);
threadsnum=(int *)calloc(sizeof(int),MAX_BEADS);
for (i=0; i<beads-1;i++)
{
fscanf(fp, "%d %d", &bead;_a, &bead;_b);
bead_a--;bead_b--;
spider[bead_a].thread[threadsnum[bead_a]]=bead_b;
threadsnum[bead_a]++;
//printf (" %d %d", bead_a, bead_b);
}
free(threadsnum);
printf("\n%d\n", spider[0].thread[1]);
if (fp!=NULL)
fclose(fp);
return 0;
}
Revise this Paste