Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## Re:注意这组数据

Posted by raycool at 2010-12-25 18:54:49 on Problem 1008
In Reply To:注意这组数据 Posted by:bergkamp at 2006-08-04 20:38:33
```> 4. uayet 259
> 正解是 13 ahau 364
> 而不是13 ahau 365
> 看看你的程序是不是 少了点情况没考虑  ：）
> cout 和 printf都可以AC
#include<stdio.h>
#include<string.h>
char *habb[]={"pop","no","zip","zotz","tzec", "xul", "yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};
char *holly[]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
int main(void)
{
int n,i,j,day,year,days,flag=1;
int year_h,t,m,count_h;
char ch;
char month[7];
scanf("%d",&n);
for(i=0;i<n;i++)
{
int count=0;
scanf("%d",&day);
scanf("%c",&ch);
scanf("%s",month);
scanf("%d",&year);
for(j=0;j<19;j++)
if(strcmp(*(habb+j),month)==0)
{
days=year*365+day+1+j*20;
break;
}
year_h=days/260;      //calculate the year of holly
if(days%260==0)
year_h--;
days=days-year_h*260;
for(t=12,m=19,count_h=1;count_h<=days;t++,m++)
{
t%=13;
m%=20;
count_h++;
}
t%=13;
m%=20;
while((flag--)>0)
printf("%d\n",n);
printf("%d %s %d\n",t+1,*(holly+m),year_h);
}
return 0;
}

Followed by: