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 |
PE到底哪里错了嘛,求救求救,拜求 #include<iostream> #include<string> using namespace std; string H[19]={"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh","mac", "kankin", "muan", "pax", "koyab", "cumhu","uayet"}; string T[20]={"imix", "ik", "akbal", "kan"," chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix","mem", "cib","caban", "eznab", "canac","ahau"}; int totaldays(int hd,int hm,int hy)//both y and m start at 0 { return hd+20*hm+365*hy+1; } int to_hm(string s) { for(int i=0;i<19;i++) if(s==H[i]) return i; } void to_T(int D) {int ty,td,tm; ty=D/260; D=D%260; if(D==0)//260 days if(ty){//the first year's ending day ty=ty-1; td=19; tm=13;} else {//the first day of world tm=1; td=0; } else {//to be more careful here tm=D%13; if(!tm) tm=13; td=(D-1)%20;//once has a mistake } cout<<tm<<" "<<T[td]<<" "<<ty<<endl; } int main() { //freopen("in.txt","r",stdin);freopen("out.txt","w",stdout); int t; cin>>t; cout<<t<<endl; while(t--){ double hd; int hy,hm; string m; cin>>hd>>m>>hy; hm=to_hm(m); int Ds; Ds=totaldays(hd,hm,hy); to_T(Ds); } //system("pause"); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator