1 #include <stdio.h> 2 #include <stdlib.h> 3 struct node 4 { 5 int date1,date2; 6 struct node*next; 7 } node; 8 int main() 9 { 10 struct node*p,*head,*end,*q; 11 head=(struct node*)malloc(sizeof(struct node)); 12 head->next=NULL; 13 end=head; 14 int n,i; 15 scanf("%d",&n); 16 p=(struct node*)malloc(sizeof(struct node)); 17 p->next=NULL; 18 q=(struct node*)malloc(sizeof(struct node)); 19 q->next=NULL; 20 head->next=p; 21 p->next=q; 22 q->next=NULL; 23 p->date1=0; 24 p->date2=1; 25 q->date1=1; 26 q->date2=1; 27 for(i=1; i<=n; i++) 28 { 29 end=head->next; 30 while(end->next!=NULL) 31 { 32 p=end->next; 33 if((p->date2+end->date2)<=i) 34 { 35 q=(struct node*)malloc(sizeof(struct node)); 36 q->date1=end->date1+p->date1; 37 q->date2=end->date2+p->date2; 38 q->next=NULL; 39 end->next=q; 40 q->next=p; 41 end=end->next->next; 42 } 43 else 44 { 45 end=end->next; 46 } 47 } 48 } 49 50 p=head->next; 51 int mark=0; 52 for(; p!=NULL; p=p->next) 53 { 54 if(mark!=0)printf("\t"); 55 mark++; 56 printf("%d/%d",p->date1,p->date2); 57 if(mark==10)printf("\n"),mark=0; 58 59 } 60 return 0; 61 }