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:我也通过了,但还是WA 啊!!再给几组吧????In Reply To:我也通过了,但还是WA 啊!!再给几组吧???? Posted by:lengzhigang at 2009-08-20 13:27:06 > 这组我也通过了,但还是WA,请高手帮忙啊 > > 我的代码如下: > > > > > > > #include<stdio.h> > #include<string.h> > > void tran(int Hday,char *q,int Hyear) > { > int i=0,yu,Ti,Tyear,Tday; > long int allday; > char *mon[20]= {"imix","ik","akbal","kan","chichan","cimi","manik", > "lamat","mulak","ok","chuen","eb","ben","ix","mem","cib","caban", > "eznab","canac","ahau"}; > char *m[19]={"pop","no","zip","zotz","tzec", "xul","yoxkin","mol","chen","yax","zac", > "ceh","mac","kankin","muan","pax","koyab","cumhu", "uayet"}; > > while(strcmp(m[i],q)!=0) > i++; > allday=Hyear*365+i*20+Hday+1; > Tyear=allday/260; > if(allday%20==0) Tyear=Tyear-1; > else yu=allday%260; > if(yu%13==0) Tday=13; > else Tday=yu%13; > if(yu%20==0) Ti=20; > else Ti=yu%20; > printf("%d %s %d\n",Tday,mon[Ti-1],Tyear); > > } > > int main() > { > int a, b, Hday, Hyear; > char p[20]; > scanf("%d",&b); > printf("%d\n",b); > for(a=0;a<b;a++) > { scanf("%d.%s%d",&Hday,p,&Hyear); > tran(Hday,p,Hyear); > > } > return 0; > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator