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> using namespace std; int result[99999][2],flag=0; void zhuanhuan(int d,char tem[10],int y) { int zy=0;//从历史到现在的总天数 zy=0; zy+=y*365+d; if(strcmp(tem,"pop")==0) { zy+=20*0; } else if(strcmp(tem,"no")==0) { zy+=20*1; } else if(strcmp(tem,"zip")==0) { zy+=20*2; } else if(strcmp(tem,"zotz")==0) { zy+=20*3; } else if(strcmp(tem,"tzec")==0) { zy+=20*4; } else if(strcmp(tem,"xul")==0) { zy+=20*5; } else if(strcmp(tem,"yoxkin")==0) { zy+=20*6; } else if(strcmp(tem,"mol")==0) { zy+=20*7; } else if(strcmp(tem,"chen")==0) { zy+=20*8; } else if(strcmp(tem,"yax")==0) { zy+=20*9; } else if(strcmp(tem,"zac")==0) { zy+=20*10; } else if(strcmp(tem,"ceh")==0) { zy+=20*11; } else if(strcmp(tem,"mac")==0) { zy+=20*12; } else if(strcmp(tem,"kankin")==0) { zy+=20*13; } else if(strcmp(tem,"muan")==0) { zy+=20*14; } else if(strcmp(tem,"pax")==0) { zy+=20*15; } else if(strcmp(tem,"koyab")==0) { zy+=20*16; } else if(strcmp(tem,"cumhu")==0) { zy+=20*17; } else if(strcmp(tem,"uayet")==0) { zy+=20*18; } else { cout<<"WA!"; } if(zy<=260) { result[flag][1]=0; } else { result[flag][1]=zy/260; if(zy%260==0) { result[flag][1]--; } } result[flag][0]=zy; flag++; } void output(int i) { int x=0,p,q; x=result[i][0]-result[i][1]*260; if(x<=13) cout<<x<<" "; else { p=x-(x/13)*13; if(x%13==0) { p=13; } cout<<p<<" "; } if(x<=20) { q=x; } else { q=x-(x/20)*20; if(x%20==0) { q=20; } } if(q==1) { cout<<"imix"<<" "; } else if(q==2) { cout<<"ik"<<" "; } else if(q==3) { cout<<"akbal"<<" "; } else if(q==4) { cout<<"kan"<<" "; } else if(q==5) { cout<<"chicchan"<<" "; } else if(q==6) { cout<<"cimi"<<" "; } else if(q==7) { cout<<"manik"<<" "; } else if(q==8) { cout<<"lamat"<<" "; } else if(q==9) { cout<<"muluk"<<" "; } else if(q==10) { cout<<"ok"<<" "; } else if(q==11) { cout<<"chuen"<<" "; } else if(q==12) { cout<<"eb"<<" "; } else if(q==13) { cout<<"ben"<<" "; } else if(q==14) { cout<<"ix"<<" "; } else if(q==15) { cout<<"mem"<<" "; } else if(q==16) { cout<<"cib"<<" "; } else if(q==17) { cout<<"caban"<<" "; } else if(q==18) { cout<<"eznab"<<" "; } else if(q==19) { cout<<"canac"<<" "; } else if(q==20) { cout<<"ahau"<<" "; } else { cout<<"WA!"; } cout<<result[i][1]<<endl; } int main() { int n,i,j,y,d,l; char p[9999]; char tem[10]; cin>>n; for(i=0;i<n;i++) { l=0; d=0; cin>>p>>y; //开始处理转换成从世界开始到现在的天数 for(j=0;;j++) { if(p[j]=='.') break; else if(j==0) { d=((int)p[j]-48)*10; } else if(j==1) { d+=(int)p[j]-48; } } if(j==1) d=d/10; d=d+1; while(p[j]!='\0') { tem[l]=p[j+1]; l++; j++; } zhuanhuan(d,tem,y); } cout<<n<<endl; for(i=0;i<n;i++) { output(i); } //system("pause"); return 0; } 直接去判断的,没用数组存月份,就是代码长了点,但是我找的到的所有测试数据都对的,提交就WA,实在不明白。。大家帮看看吧。。。谢谢啊 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator