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 |
大家给的数据都过了,为什么还是WRONG啊,求大神指教!!!!#include<stdio.h> #include<string.h> int main() {int n,i,j,date[100],haab[100],hooly[100],a[100],b[100]; long day; char mon[100][20],s[19][8]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"}, t[21][10]={" ","imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"}; char ch; scanf("%d",&n); for (i=0;i<n;i++) {scanf("%d%c%c",&date[i],&ch,&ch); j=0; scanf("%c",&mon[i][j]); while (mon[i][j]!=' ') {j++; scanf("%c",&mon[i][j]);} mon[i][j]='\0'; scanf("%d",&haab[i]); } for (i=0;i<n;i++) {for (j=0;j<19;j++) if (strcmp(mon[i],s[j])==0) {day=20*j; break;} day+=365*haab[i]+date[i]+1; if (day%260==0) {hooly[i]=day/260-1; a[i]=13; b[i]=20;} else{ hooly[i]=day/260; day=day%260; a[i]=day%13; if (a[i]==0) a[i]=13; b[i]=day%20; if (b[i]==0) b[i]=20; } } printf("%d\n",n); for (i=0;i<n;i++) {printf("%d ",a[i]); j=0; while (t[b[i]][j]!='\0') {printf("%c",t[b[i]][j]); j++;} printf(" %d\n",hooly[i]); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator