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 |
一次AC.纪念一下贴下代码,不清楚输入输出格式的可以看一下。 #include <algorithm> #include <iostream> #include <vector> #include <string> using namespace std; vector<string> Haab ; vector<string> Tzolkin ; void init() { Haab.push_back("pop"); Haab.push_back("no"); Haab.push_back("zip"); Haab.push_back("zotz"); Haab.push_back("tzec"); Haab.push_back("xul"); Haab.push_back("yoxkin"); Haab.push_back("mol"); Haab.push_back("chen"); Haab.push_back("yax"); Haab.push_back("zac"); Haab.push_back("ceh"); Haab.push_back("mac"); Haab.push_back("kankin"); Haab.push_back("muan"); Haab.push_back("pax"); Haab.push_back("koyab"); Haab.push_back("cumhu"); Haab.push_back("uayet"); Tzolkin.push_back("imix"); Tzolkin.push_back("ik"); Tzolkin.push_back("akbal"); Tzolkin.push_back("kan"); Tzolkin.push_back("chicchan"); Tzolkin.push_back("cimi"); Tzolkin.push_back("manik"); Tzolkin.push_back("lamat"); Tzolkin.push_back("muluk"); Tzolkin.push_back("ok"); Tzolkin.push_back("chuen"); Tzolkin.push_back("eb"); Tzolkin.push_back("ben"); Tzolkin.push_back("ix"); Tzolkin.push_back("mem"); Tzolkin.push_back("cib"); Tzolkin.push_back("caban"); Tzolkin.push_back("eznab"); Tzolkin.push_back("canac"); Tzolkin.push_back("ahau"); } int main() { int t ; int i ; int day; int H_day; string H_month; int H_year; int T_day; string T_month; int T_month_it; int T_year; vector<string>::iterator it; init(); cin>>t; if(t!=0) cout<<t<<endl; for( i = 0 ; i < t ; i++) { cin>>H_day; getchar(); cin>>H_month; cin>>H_year; it = find(Haab.begin(), Haab.end(), H_month); day = H_year * 365 + (it- Haab.begin() ) * 20 + H_day + 1; T_year = day / 260 ; day = day % 260 ; if( day%260 == 0) T_year--; T_month_it = day% 20 ; if(T_month_it == 0) T_month_it = 20 ; T_month = Tzolkin[T_month_it -1] ; T_day = day % 13; if(T_day == 0) T_day = 13 ; cout<<T_day<<" "<<T_month<<" "<<T_year<<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