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 <iostream> #include <iomanip> #include <cstring> using namespace std; int strcmp(char n1[10],char n2[10]) { int i; if(strlen(n1)!=strlen(n2))return(0); for(i=0;n1[i];i++) if(n1[i]!=n2[i])return(0); return(1); } int main() { const int slength=9; int i,j,a,q,l; char month[slength]; cin>>a; for(l=0;l<a;l++) { scanf("%d. %s %d",&i,month,&j); int m(0),n; if(strcmp(month,"pop")==1)m=1; if(strcmp(month,"no")==1)m=2; if(strcmp(month,"zip")==1)m=3; if(strcmp(month,"zotz")==1)m=4; if(strcmp(month,"tzec")==1)m=5; if(strcmp(month,"xul")==1)m=6; if(strcmp(month,"yoxkin")==1)m=7; if(strcmp(month,"mol")==1)m=8; if(strcmp(month,"chen")==1)m=9; if(strcmp(month,"yax")==1)m=10; if(strcmp(month,"zac")==1)m=11; if(strcmp(month,"ceh")==1)m=12; if(strcmp(month,"mac")==1)m=13; if(strcmp(month,"kankin")==1)m=14; if(strcmp(month,"muan")==1)m=15; if(strcmp(month,"pax")==1)m=16; if(strcmp(month,"koyab")==1)m=17; if(strcmp(month,"cumhu")==1)m=18; if(strcmp(month,"uayet")==1)m=19; n=i+1+(m-1)*20+j*365; cout<<n%13<<' '; q=(n-1)/260; n=n%260; n=n%20; switch(n) { case 1:cout<<"imix";break;case 2:cout<<"ik";break; case 3:cout<<"akbal";break;case 4:cout<<"kan";break; case 5:cout<<"chicchan";break;case 6:cout<<"cimi";break; case 7:cout<<"manik";break;case 8:cout<<"lamat";break; case 9:cout<<"muluk";break;case 10:cout<<"ok";break; case 11:cout<<"chuen";break;case 12:cout<<"eb";break; case 13:cout<<"ben";break;case 14:cout<<"ix";break; case 15:cout<<"mem";break;case 16:cout<<"cib";break; case 17:cout<<"caban";break;case 18:cout<<"eznab";break; case 19:cout<<"canac";break;case 0:cout<<"ahau";break; } cout<<' '<<q<<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