| ||||||||||
| 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<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAXIUM 7000
struct tx
{
int day;
char month[10];
int year;
}txy[MAXIUM];
int main()
{
char hab[19][7]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};
char holly[20][10]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
char ru[10];
int num,year1,ri,total,lenth;
int i,m=0;
scanf("%d",&num);
for(i=0;i<num;i++)
{
scanf("%d.%s %d",&ri,&ru,&year1);
lenth=strlen(ru);
for(m=0;m<19;m++)
{
if(strcmp(hab[m],ru)==0)
break;
}
total=365*year1+20*m+ri+1;
if(total%260==0)
{
txy[i].year=total/260-1;
txy[i].day=13;
strcpy(txy[i].month,holly[19]);
}
else if(total%13==0)
{
txy[i].year=total/260;
txy[i].day=13;
strcpy(txy[i].month,holly[total%20-1]);
}
else if(total%20==0)
{
txy[i].year=total/260;
txy[i].day=total%13;
strcpy(txy[i].month,holly[19]);
}
else
{
txy[i].year=total/260;
txy[i].day=total%13;
strcpy(txy[i].month,holly[total%20-1]);
}
}
for(i=0;i<num;i++)
printf("%d %s %d\n",txy[i].day,txy[i].month,txy[i].year);
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator