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 ANSWER 啊? 谢谢了 #include<string.h> #include<malloc.h> #include<stdio.h> struct haab{ char m[10];} ha[19]={{"pop"},{"no"},{"zip"},{"zotz"},{"tzec"},{"xul"},{"yoxkin"},{"mol"}, {"chen"},{"yax"},{"zac"},{"ceh"},{"mac"},{"kankin"},{"muan"},{"pax"},{"koyab"},{"cumhu"}}; struct tzolkin{ char d[10];} tz[20]={{"imix"},{"ik"},{"akbal"},{"kan"},{"chicchan"},{"cimi"},{"manik"},{"lamat"},{"muluk"}, {"ok"},{"chuen"},{"eb"},{"ben"},{"ix"},{"mem"},{"cib"},{"caban"},{"eznab"},{"canac"},{"ahau"}}; struct day{ int d,y; char m[10]; }; void main () { struct day *p; int n,i,j,m,total; scanf("%d",&n); p=(struct day *)malloc(sizeof(day)*n); for(i=0;i<n;i++){ scanf("%d. %s %d",&(p+i)->d,(p+i)->m,&(p+i)->y); if((p+i)->y>5000) goto end; for(j=0;j<19;j++){ if(!(strcmp((p+i)->m,ha[j].m))) m=j;} total=((p+i)->d+1)+m*20+(p+i)->y*365; (p+i)->y=total/260; if(total%260%13!=0) (p+i)->d=(total%260%13); else (p+i)->d=13; if(total%260%20!=0) m=total%260%20-1; else m=20-1; strcpy((p+i)->m,tz[m].d);} printf("%d\n",n); for(i=0;i<n;i++){ printf("%d %s %d\n",(p+i)->d,(p+i)->m,(p+i)->y);} end:;} Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator