e.... 虽然这是一道灰常简单的模拟题、但是米做的时候没有读懂第二个日历的计时方法。然后捏。敲完之后华丽的WA了进一个点。坑点就在一年的最后一天你是该输出本年的。e ...但是我好想并没有。、看discuss里好想被坑的人还不少。总天数能直接整除260的时候。年数要减1。
不喜欢做模拟.....5555....
附代码:
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<string>
#include<map>
using namespace std;
string Maya_name[20] = {"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu", "uayet"};
string Holly_name[21] = {"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>m;
m.clear();
for (int i=0; i<19; ++i)
{
m[Maya_name[i]] = i;
}
map<int, string>mm;
mm.clear();
for (int i=0; i<20; ++i)
{
mm[i+1] = Holly_name[i];
}
int t, total;
int day, year;
char temp;
string month;
while(cin >> t)
{
cout << t << endl;
while(t--)
{
total = 0;
cin >> day >> temp >> month >> year;
int tm = m[month];
total += year * 365 + tm * 20 + day + 1;
// cout << total << "==\n";
year = total / 260;
int tot = total;
tot %= 260;
tm = tot % 20;
if (tm == 0) tm = 20;
day = total % 13;
if (day == 0) day = 13;
if (total % 260 == 0)
{
year -= 1;
}
cout << day << ‘ ‘ << mm[tm] << ‘ ‘ << year << endl;
}
}
return 0;
}