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> #include<sstream> using namespace std; int main() { int ncases,year,days; string day,month; int tday[10000]; string tmonth[10000]; int tyear[10000]; string haab[19] = {"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"}; string tzolkin[20] = {"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat"," muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"}; cin>>ncases; for(int i = 0; i < ncases; i++) { cin>>day>>month>>year; string daystr = ""; for(int l = 0; l < day.size()-1; l++) { daystr += day[l]; } stringstream ss; int dayint = 0; ss<<daystr; ss>>dayint; for(int k = 0; k < 19; k++) { if(month == haab[k]) { days = year*365 + k * 20 + dayint; break; } } tyear[i] = days/260; int tmod = days%260; tmonth[i] = tzolkin[tmod%20]; tday[i] = tmod%13 + 1; } cout<<ncases<<endl; for(int i = 0; i < ncases; i++) { cout<<tday[i]<<" "<<tmonth[i]<<" "<<tyear[i]<<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