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 |
放弃了,查了2天了,就是没查出错,高手指点一下,为什么一直是WA~~~~~~~#include <iostream> #include <string> #include <cstdio> using namespace std; char a[19][7]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin", "muan","pax","koyab","cumhu","uayet"}; char b[20][9]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben", "ix","mem","cib","caban","eznab","canac","ahau"}; int main(){ int num; scanf("%d",&num); printf("%d\n",num); for(int i=0;i<num;i++){ char month[7]; int hday,hmonth,hyear,tnum,tname,tyear,allday; scanf("%d. %s %d",&hday,month,&hyear); for(hmonth=0;hmonth<19;hmonth++)if(strcmp(a[hmonth],month)==0)break; allday=(hday+1)+20*hmonth+365*hyear; tyear=(allday-1)/260; if((allday-260*tyear)%20!=0)tname=(allday-260*tyear)%20-1; else tname=19; if((allday-260*tyear)%13!=0)tnum=(allday-260*tyear)%13; cout <<tnum<<" "<<b[tname]<<" "<<tyear<<endl; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator