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 <math.h> #include <string.h> int n,year,number,name; char Haab[19][7]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen", " yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"}; char Tzoltin[20][9]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok", "chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"}; long int readIn(){ char day[4],month[7]; long int i,y,length,m=0,total,p; scanf("%s%s%d",day,month,&y); length=strlen(day); total=y*365; for (i=0;i<length-1;i++) m=m*10+(day[i]-'0'); for (i=0;i<18;i++){ p=strcmp(month,Haab[i]); if (p==0) { total=total+20*i; break; } } if (i==18) total=total+360; total=total+m+1; printf("%d\n",total); return total; } void main(){ int i; long int days; scanf("%d",&n); printf("%d\n",n); for (i=0;i<n;i++){ days=readIn(); year=(days-1)/260; days=(days-1)%260+1; number=(days-1)%13+1; name=(days-1)%20+1; printf("%d %s %d\n",number,Tzoltin[name-1],year); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator