| ||||||||||
| 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 | |||||||||
大神帮瞅瞅哪里WA啊啊啊!!!#include <iostream>
#include <string>
#include <math.h>
#include <sstream>
using namespace std;
const char* Hmonth[19] =
{
"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax",
"zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu","uayet",
};
const char Tday1[20][10] =
{
"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk",
"ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau",
};
int main()
{
int n;
cin>>n;
for (int i=0; i<n; i++)
{
string in1,in2,in3;
cin>>in1>>in2>>in3;
int HMonth=0, HDay=0, HYear=0;
//计算年
HYear = atoi(in3.c_str());
//计算H天
in1.erase(in1.end() - 1);
HDay = atoi(in1.c_str());
//计算H月
for (int j=0; j<19; j++)
{
stringstream ss;
ss<<Hmonth[j];
string month;
ss>>month;
if (in2 == month)
{
HMonth = j;
break;
}
}
//计算总天数
long Allday;
Allday = HYear*365 + HMonth*20 + HDay + 1;
int TDay1,TDay2,TYear;
//计算输出年
TYear = (Allday-1)/260 ;
Allday -= TYear*260;
//计算输出天1
TDay1 = Allday%20;
if (TDay1 == 0) TDay1 = 20;
//计算输出天2
TDay2 = Allday%13;
if (TDay2 == 0) TDay2 = 13;
cout<<TDay2<<" "<<Tday1[TDay1 - 1]<<" "<<TYear<<endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator