Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register
北京大学《ACM/ICPC大学生程序设计竞赛训练》暑期课面向全球招生!

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:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator