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 |
请哪位牛人帮忙看一下,为什么总是WA#include <iostream.h> #include <math.h> #include <string.h> char *str[]={"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol" , "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab" , "cumhu","uayet"}; char *tzolkin[]={"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk" , "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"}; void main(){ int number; int count=0; cin>>number; cin.get(); while(count<number){ char input[20]; char month[6]; cin.getline(input,20); int k=0; long day=0; long year=0; long total=0; while(input[k]!='.') { k++; } for(int j=0;j<k;j++) { day+=(input[j]-'0')*long(pow(10,k-j-1));} for(int i=0;input[i]!='\0';i++); for( j=i-1;input[j]!=' ';j--) { year+=(input[j]-'0')*long(pow(10,i-j-1));} j=0; for(i=k+2;input[i]<='z'&&input[i]>='a';i++) { month[j]=input[i]; j++;} month[j]='\0'; for(i=0;i<20;i++) { for(j=0;month[j]!='\0';j++) { if(month[j]!=str[i][j]) break;} if(month[j]=='\0') break; } total=year*365+i*20+day; year=total/260; day=total%13+1; long monthnum=(total%20); cout<<day<<" "<<tzolkin[monthnum]<<" "<<year<<endl; count++;} } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator