| ||||||||||
| 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.h>
using namespace std;
typedef struct Time
{
int day;
char c;
char month[22];
int year;
}time;
int main()
{
char month1[22][22]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax",
"zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};
char month2[22][23]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk",
"ok","chuen","eb", "ben","ix","mem","cib","caban","eznab","canac","ahau"};
time T1,T2;
int temp;
int i,j,n;
cin>>n;
cout<<n<<endl;
for(i=0;i<n;i++)
{
cin>>T1.day>>T1.c>>T1.month>>T1.year;
for(j=0;j<19;j++)
{
if(strcmp(T1.month,month1[j])==0)
break;
}
T2.year=((T1.year)*365+j*20+T1.day+1)/260;
temp=((T1.year)*365+j*20+T1.day+1)%260%20;
strcpy(T2.month,month2[temp-1]);
T2.day=(((T1.year)*365+j*20+T1.day+1)%260)%13;
if(((T1.year)*365+j*20+T1.day+1)%260==0)
{
T2.year--;
strcpy(T2.month,"ahau");
T2.day=13;
}
cout<<T2.day<<" "<<T2.month<<" "<<T2.year<<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