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

Re:我的测试数据都是对的，实在找不到错误，大神们帮我找找，感激不尽

Posted by iamexcellent at 2013-06-12 21:26:13 on Problem 1008
In Reply To:太伟大了 Posted by:BYR2012 at 2013-04-16 18:58:30
```#include <iostream>
#include <map>
#include <string>
using namespace std;

int main(void)
{
map<string, int> hmonth;          //maps a haab month to a number
map<int, string> tmonth;           //maps a number to a Tzo month
hmonth["pop"] = 0;
hmonth["no"] = 1;
hmonth["zip"] = 2;
hmonth["zotz"] = 3;
hmonth["tzec"] = 4;
hmonth["xul"] = 5;
hmonth["yoxkin"] = 6;
hmonth["mol"] = 7;
hmonth["chen"] = 8;
hmonth["yax"] = 9;
hmonth["zac"] = 10;
hmonth["ceh"] = 11;
hmonth["mac"] = 12;
hmonth["kankin"] = 13;
hmonth["muan"] = 14;
hmonth["pax"] = 15;
hmonth["koyab"] = 16;
hmonth["cumbu"] = 17;
hmonth["uayet"] = 18;
tmonth[1] = "imix";
tmonth[2] = "ik";
tmonth[3] = "akbal";
tmonth[4] = "kan";
tmonth[5] = "chicchan";
tmonth[6] = "cimi";
tmonth[7] = "manik";
tmonth[8] = "lamat";
tmonth[9] = "muluk";
tmonth[10] = "ok";
tmonth[11] = "chuen";
tmonth[12] = "eb";
tmonth[13] = "ben";
tmonth[14] = "ix";
tmonth[15] = "mem";
tmonth[16] = "cib";
tmonth[17] = "caban";
tmonth[18] = "eznab";
tmonth[19] = "canac";
tmonth[20] = "ahau";
int n;     //number of dates to be transformed
cin >> n;
int *day = new int[n];
string *month= new string[n];
int *year = new int[n];
for(int i = 0; i < n; i++)
{
cin >> day[i];
cin.get();
cin >> month[i];
cin >> year[i];
}
cout << n << endl;
for(int i = 0; i < n; i++)
{
int numday = 0;
numday += 365 * year[i];
numday += 20 * hmonth[month[i]];
numday += day[i] + 1;
int tnum = 0;
string tmpm = "";
int tyear = 0;
if(numday % 260 == 0)
tyear = numday / 260 - 1;
else
tyear = numday / 260;
//numday %= 260;
if(numday % 20 == 0)
tmpm = tmonth[20];
else
tmpm = tmonth[numday % 20];
if(numday % 13 == 0)
tnum = 13;
else
tnum = numday % 13;
cout << tnum << " " << tmpm << " " << tyear << endl;
}
return 0;
}```

Followed by: