| ||||||||||
| 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 | |||||||||
为什么总是错,测试都是对的,求指导#include <iostream>
#include <map>
#include <string>
#include <cstdio>
using namespace std;
const string HaabYear[19]={"pop", "no", "zip","zotz", "tzec",
"xul", "yoxkin", "mol", "chen", "yax",
"zac", "ceh", "mac", "kankin", "muan",
"pax", "koyab", "cumhu","uayet"};
const string Tzolkin[20]={"imix", "ik", "akbal", "kan", "chicchan",
"cimi", "manik", "lamat", "muluk",
"ok", "chuen", "eb", "ben", "ix",
"mem", "cib", "caban", "eznab", "canac","canac"};
map<string,int> HaabYearMap;
void Init()
{
int i;
for(i=0;i<19;i++){
HaabYearMap.insert(make_pair(HaabYear[i],i+1));
}
}
int Haab(const string& str,const string &month,int year)
{
int i=0;
int day = 0;
int ret;
string tmp;
while(str[i]>='0'&&str[i]<='9'){
day = day*10+str[i]-'0';
i++;
}
ret = year*365+(HaabYearMap[month]-1)*20+day+1;
return ret;
}
void Haab2Tzolkin(const string& str,const string &month,int year)
{
int day = Haab(str,month,year);
int rem = day%260;
cout<<rem%13<<" ";
cout<<Tzolkin[rem%20-1]<<" ";
cout<<day/260<<endl;
}
int main()
{
Init();
int n,i=0;
cin>>n;
while(n--){
string day,month;
int year;
cin>>day>>month;
cin>>year;
Haab2Tzolkin(day,month,year);
}
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