| ||||||||||
| 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 | |||||||||
Re:I don't know where the mistake is,who can help me?In Reply To:I don't know where the mistake is,who can help me? Posted by:loving_you2000 at 2008-09-17 19:23:46 #include<cstdlib>
#include<iostream>
#include<string>
using namespace std;
int main()
{
char *HaabMonth[20]=
{"pop", "no", "zip", "zotz", "tzec", "xul","yoxkin", "mol", "chen",
"yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu","uayet",""};
string HaabDay[20]=
{"0.","1.","2.","3.","4.","5.","6.","7.","8.","9.","10.","11.","12.",
"13.","14.","15.","16.","17.","18.","19."};
string TzolkinName[20]=
{"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk",
"ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
int Case;
string InputDay,InputMonth,OutputName;
int InputYear,Days=0,OutputYear,OutputNumber,TempDay;
cin>>Case;
cout<<Case<<endl;
for(int i=0;i< Case;i++)
{
Days = 0;
cin>>InputDay>>InputMonth>>InputYear;
Days += InputYear*365;
for(int j=0;j<20;j++)
{
if(InputMonth == HaabMonth[j])
{
Days+=j*20;
}
if(InputDay == HaabDay[j])
{
Days += j + 1;
}
}
if(Days%260 == 0)
{
OutputYear = (Days/260) - 1;
OutputNumber = 13;
OutputName = TzolkinName[19];
}
else
{
OutputYear=Days/260;
OutputNumber=Days%13;
if(OutputNumber == 0)
{
OutputNumber = 13;
}
TempDay=Days%20;
if(TempDay == 0)
OutputName = TzolkinName[19];
else
OutputName=TzolkinName[ TempDay - 1 ];
}
cout<<OutputNumber<<" "<<OutputName<<" "<<OutputYear<<endl;
Days=0;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator