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 |
我将输出格式改为整体输出也一直wrang answer啊!郁闷!!!!!!!!!!!求救啊!!!!!!!!!#include<stdio.h> #include<string.h> #define MAX 1000 typedef struct { char hmon[1],tmon[1]; int hyear,tyear; int hday,tday; }Maya; void main() { long total; Maya cw[MAX]; int n,i,m,tmpmon; scanf("%d",&n); for(i=0;i<n;i++) { m=0; scanf("%d.%s%d",&cw[i].hday,cw[i].hmon,&cw[i].hyear); if(cw[i].hyear>=5000) continue; if(!strcmp(cw[i].hmon,"pop")) m=1; else if(!strcmp(cw[i].hmon,"no")) m=2; else if(!strcmp(cw[i].hmon,"zip")) m=3; else if(!strcmp(cw[i].hmon,"zotz")) m=4; else if(!strcmp(cw[i].hmon,"tzec")) m=5; else if(!strcmp(cw[i].hmon,"xul")) m=6; else if(!strcmp(cw[i].hmon,"yoxkin")) m=7; else if(!strcmp(cw[i].hmon,"mol")) m=8; else if(!strcmp(cw[i].hmon,"chen")) m=9; else if(!strcmp(cw[i].hmon,"yax")) m=10; else if(!strcmp(cw[i].hmon,"zac")) m=11; else if(!strcmp(cw[i].hmon,"ceh")) m=12; else if(!strcmp(cw[i].hmon,"mac")) m=13; else if(!strcmp(cw[i].hmon,"kankin")) m=14; else if(!strcmp(cw[i].hmon,"muan")) m=15; else if(!strcmp(cw[i].hmon,"pax")) m=16; else if(!strcmp(cw[i].hmon,"koyab")) m=17; else if(!strcmp(cw[i].hmon,"cumhu")) m=18; else if(!strcmp(cw[i].hmon,"uayet")) m=19; total=cw[i].hyear*365+20*(m-1)+cw[i].hday+1; cw[i].tyear=(total-1)/260; total%=260; if(total==0) { cw[i].tday=13; strcpy(cw[i].tmon,"ahau"); continue; } cw[i].tday=total%13; if(cw[i].tday==0) cw[i].tday=13; tmpmon=total%20; switch(tmpmon) { case 0: strcpy(cw[i].tmon,"ahau"); break; case 1: strcpy(cw[i].tmon,"imix"); break; case 2: strcpy(cw[i].tmon,"ik"); break; case 3: strcpy(cw[i].tmon,"akbal"); break; case 4: strcpy(cw[i].tmon,"kan"); break; case 5: strcpy(cw[i].tmon,"chicchan"); break; case 6: strcpy(cw[i].tmon,"cimi"); break; case 7: strcpy(cw[i].tmon,"manik"); break; case 8: strcpy(cw[i].tmon,"lamat"); break; case 9: strcpy(cw[i].tmon,"muluk"); break; case 10: strcpy(cw[i].tmon,"ok"); break; case 11: strcpy(cw[i].tmon,"chuen"); break; case 12: strcpy(cw[i].tmon,"eb"); break; case 13: strcpy(cw[i].tmon,"ben"); break; case 14: strcpy(cw[i].tmon,"ix"); break; case 15: strcpy(cw[i].tmon,"mem"); break; case 16: strcpy(cw[i].tmon,"cib"); break; case 17: strcpy(cw[i].tmon,"caban"); break; case 18: strcpy(cw[i].tmon,"eznab"); break; case 19: strcpy(cw[i].tmon,"canac"); break; } } printf("%d\n",n); for(i=0;i<n;i++) { printf("%d %s %d\n",cw[i].tday,cw[i].tmon,cw[i].tyear); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator