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 |
C++#include <iostream> #include <stdlib.h> #include <map> #include <string> using namespace std; int main(void) { int n = 0; int days,year=0; string day,month; map<string, int>mayaCalender; string m[] = {"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu" ,"uayet"};//19 string d[] = { "imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat","muluk", "ok","chuen", "eb", "ben", "ix","mem", "cib", "caban", "eznab", "canac","ahau"};//20 for (int i = 0; i < 19; i++) mayaCalender[m[i]] = 20*i; cin >> n; cout << n << endl; while (n-->0 ){ cin >> day >> month >> year; day = day.erase(day.find('.'),1); //输入日期转成总天数 days = year * 365 + mayaCalender[month] + atoi(day.c_str()); //再转成目标日期 year = days / 260; int number = (days % 260) % 13+1; day = d[(days % 260) % 20]; cout << number << " " << day << " " << year << endl; } 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