Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## //一年的最后一天这种特殊情况要考虑 //要打印测试用例数 //月份名字不要写错了

Posted by 2715599212 at 2019-08-12 17:56:38 on Problem 1008
```#include <iostream>
#include <stdio.h>
#include <vector>
#include <map>
#include <string>

//一年的最后一天的特殊情况要考虑
//要打印测试用例数
//月份名字不要写错了

using namespace std;
const string Haab_monthnames[19] = {"pop","no","zip","zotz","tzec","xul","yoxkin","mol",
"chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};
const string Tzolkin_days[20] = {"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};

int main() {
map<string, int> Haab_months;
for (int i = 0; i < 19; i++) {
string str = Haab_monthnames[i];
Haab_months[str] = i;
}
int n;
string date,month;
int year;
cin >> n;
cout << n << endl;
for (int id = 0; id < n; id++) {
cin >> date >>month>> year;
string v = "";
int day = 0;
for (int j = 0; j < date.length(); j++) {
if (date[j] == '.')
break;

v.push_back(date[j]);
}

for (int i = 0; i < v.length(); i++) {
day = day * 10 + v[i] - '0';
}

int days = year * 365 + Haab_months[month] * 20 + day+1;

int Tzolkin_year = days / 260;
int Tzolkin_date = days % 260;

if (Tzolkin_year > 0 && Tzolkin_date == 0) {
Tzolkin_year--;
Tzolkin_date = 260;
}

int Tzolkin_month = Tzolkin_date % 13;
if (Tzolkin_month == 0)
Tzolkin_month = 13;

int Tzolkin_day = Tzolkin_date % 20;
if (Tzolkin_day == 0)
Tzolkin_day = 20;

string T_d = Tzolkin_days[Tzolkin_day-1];
cout << Tzolkin_month << ' ' << T_d << ' ' << Tzolkin_year << endl;
}

return 0;
}```

Followed by: