Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
为什么WA呢?大家帮指点一下!#include<stdio.h> #include<string.h> char haab[19][10]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};; char tz[20][10]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"}; void f(int num1,char s1[10],int year1,int j1) { int k=0,temp=0,flag=0,j=0; int sum=0; int num2,year2; char s2[10]; for(j=0;j<10;j++) s2[j]=' ';//s2用于记录所要输出的月份 sum=year1*365+(j1-1)*20+num1+1;//计算总的天数 year2=sum/260;//输出的年数 num2=sum%260;//num2标记一年中的num2几天 k=0; temp=(num2)%20-1;//月数 while(tz[temp][k]!=0) { s2[k]=tz[temp][k]; k++; } num2=(num2+13)%13;//第num2天 printf("%d ",num2); k=0; while(s2[k]!=' ') { printf("%c",s2[k]); k++; } printf(" %d\n",year2); } void main() { int num,year,n,i=0,j=0,k=0,flag=0; char s[10]; scanf("%d",&n); while(i<n) { scanf("%d.",&num);//输入要求的三个字段 scanf("%s",s); scanf("%d",&year); if(year>=5000 || year<0) return;//年份的大小限制 while(flag!=1)//月份中天数限制 { while((haab[k][0]!=s[0])) { k++; } while(haab[k][j]==s[j]) { j++; } k++; if(haab[k-1][j]=='\0') flag++; else continue; } if(k>19) return;//所输入的月份不存在,不在19个月份中 if(k==19) { if(num<0 || num>4) return; } else { if(num<0 || num>19) return; } f(num,s,year,k); i++; } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator