PKU 1008
Maya Calendar
月名をコピペするときにスペースが入ったせいで、Presentation Errorが出て悩んだ。
#include <iostream> #include <string> #include <algorithm> using namespace std; int main() { // month names of Haab string hmonth[19] = { "pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu", "uayet", }; // month names of Tzolkin string tmonth[20] = { "imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau", }; int n; cin >> n; cout << n << endl; for ( int i=0; i<n; i++ ) { int hy, hm, hd; // year, month, number of the day in Haab string t; cin >> hd; cin >> t; cin >> t; hm = (int)( find( hmonth, hmonth+19, t ) - hmonth ); cin >> hy; int day = hy*365 + hm*20 + hd; cout << ( day%260 % 13 ) + 1 << " "; cout << tmonth[ day%260 % 20 ] << " "; cout << day/260 << endl; } return 0; }