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<cstdio> using namespace std; int main() { struct calender { int day; char mounth[7]; int mounthnum; int year; }; calender habb; int total,cases,i; cin>>cases; calender*holly=new calender[cases]; for(i=0;i<cases;i++) { scanf("%d. %s %d",&habb.day,&habb.mounth,&habb.year); if(habb.mounth[0]=='p') { if(habb.mounth[1]=='o') habb.mounthnum=1; else habb.mounthnum=16; } else if(habb.mounth[0]=='n') habb.mounthnum=2; else if(habb.mounth[0]=='z') { if(habb.mounth[1]=='i') habb.mounthnum=3; else if(habb.mounth[1]=='o') habb.mounthnum=4; else habb.mounthnum=11; } else if(habb.mounth[0]=='t') habb.mounthnum=5; else if(habb.mounth[0]=='x') habb.mounthnum=6; else if(habb.mounth[0]=='y') { if(habb.mounth[1]=='0') habb.mounthnum=7; else habb.mounthnum=10; } else if(habb.mounth[0]=='m') { if(habb.mounth[1]=='o') habb.mounthnum=8; else if(habb.mounth[1]=='a') habb.mounthnum=13; else habb.mounthnum=15; } else if(habb.mounth[0]=='c') { if(habb.mounth[1]=='h') habb.mounthnum=9; else if(habb.mounth[1]=='e') habb.mounthnum=12; else habb.mounthnum=18; } else if(habb.mounth[0]=='k') { if(habb.mounth[1]=='a') habb.mounthnum=14; else habb.mounthnum=17; } else habb.mounthnum=19; total=(habb.mounthnum-1)*20+habb.day+1+365*habb.year; holly[i].year=total/260; if(total%260==0) holly[i].year-=1; holly[i].mounthnum=total%13; if(holly[i].mounthnum==0) holly[i].mounthnum=13; holly[i].day=total%20; } cout<<cases<<endl; for(i=0;i<cases;i++) { if(holly[i].day==1) cout<<holly[i].mounthnum<<" imix "<<holly[i].year<<endl; else if(holly[i].day==2) cout<<holly[i].mounthnum<<" ik "<<holly[i].year<<endl; else if(holly[i].day==3) cout<<holly[i].mounthnum<<" akbal "<<holly[i].year<<endl; else if(holly[i].day==4) cout<<holly[i].mounthnum<<" kan "<<holly[i].year<<endl; else if(holly[i].day==5) cout<<holly[i].mounthnum<<" chicchan "<<holly[i].year<<endl; else if(holly[i].day==6) cout<<holly[i].mounthnum<<" cimi "<<holly[i].year<<endl; else if(holly[i].day==7) cout<<holly[i].mounthnum<<" manik "<<holly[i].year<<endl; else if(holly[i].day==8) cout<<holly[i].mounthnum<<" lamat "<<holly[i].year<<endl; else if(holly[i].day==9) cout<<holly[i].mounthnum<<" muluk "<<holly[i].year<<endl; else if(holly[i].day==10) cout<<holly[i].mounthnum<<" ok "<<holly[i].year<<endl; else if(holly[i].day==11) cout<<holly[i].mounthnum<<" chuen "<<holly[i].year<<endl; else if(holly[i].day==12) cout<<holly[i].mounthnum<<" eb "<<holly[i].year<<endl; else if(holly[i].day==13) cout<<holly[i].mounthnum<<" ben "<<holly[i].year<<endl; else if(holly[i].day==14) cout<<holly[i].mounthnum<<" ix "<<holly[i].year<<endl; else if(holly[i].day==15) cout<<holly[i].mounthnum<<" mem "<<holly[i].year<<endl; else if(holly[i].day==16) cout<<holly[i].mounthnum<<" cib "<<holly[i].year<<endl; else if(holly[i].day==17) cout<<holly[i].mounthnum<<" caban "<<holly[i].year<<endl; else if(holly[i].day==18) cout<<holly[i].mounthnum<<" eznab "<<holly[i].year<<endl; else if(holly[i].day==19) cout<<holly[i].mounthnum<<" canac "<<holly[i].year<<endl; else if(holly[i].day==0) cout<<holly[i].mounthnum<<" ahau "<<holly[i].year<<endl; } delete[] holly; return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator