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 |
Re:现在把程序精简一下,却变成Runtime Error!感觉还是细节没有考虑到,请指教In Reply To:现在把程序精简一下,却变成Runtime Error!感觉还是细节没有考虑到,请指教 Posted by:xiaoxiaodi at 2006-01-11 22:51:44 > #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 main() > { > > int num,year,n,i=0,j=0,k=0,flag=0,sum=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; > if(k==19) > { > if(num<0 || num>4) return; > } > else > { > if(num<0 || num>19) return; > } > sum = year*365+(k-1)*20+num; > printf("%d %s %d\n",1+sum%13,tz[sum%20],sum/260); > i++; > k=0; > flag=0; > j=0; > } > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator