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

在下新手,求找错

Posted by lezhuliangdhu at 2012-02-07 22:42:30 on Problem 1008 and last updated at 2012-02-07 22:46:24
#include<stdio.h>
#include<string.h>
int main()
{
	int i,n,date,month,year,day,flag=1;
	char cmonth[7],haab[15],Haab[19][7]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"},Tzolkin[20][9]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
	scanf("%d",&n);
	while(n>0)
	{
		fflush(stdin);
		gets(haab);
		sscanf(haab,"%d%*c%s%d",&day,cmonth,&year);
		if(flag)
			printf("%d\n",n);
		flag=0;
		for(i=0;i<19;i++)
			if(strcmp(cmonth,Haab[i])==0)
			{
				month=i;
				break;
			}
		date=year*365+day+1+month*20;
		if(date%260!=0)
		{
			day=date%13;
			year=date/260;
			strcpy(cmonth,Tzolkin[(date%260-1)%20]);
			printf("%d %s %d\n",day,cmonth,year);
		}
		else
			printf("13 ahau %d\n",date/260-1);
		n--;
	}
	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