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 123454321 at 2006-08-14 12:20:43 on Problem 1008
#include<stdio.h>
#include<string>
#include<cmath>
struct xxx{
	int num;
	char H[10];
};
xxx a[19]={{0,"pop"},{1,"no"},{2,"zip"},{3,"zotz"},{4,"tzec"},{5,"xul"},{6,"yoxkin"},{7,"mol"},{8,"chen"},{9,"yax"},
			{10,"zac"},{11,"ceh"},{12,"mac"},{13,"kankin"},{14,"muan"},{15,"pax"},{16,"koyab"},{17,"cumhu"},{18,"uayet"}};
char T[20][10]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok",
				"chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
int main()
{
	register int i;
	int n,daynum,monthnum,year,T_year,T_num,T_day,daytotal;
	char month[10];
	scanf("%d",&n);
	printf("%d\n",n);
	while(n--)
	{
		scanf("%d. %s %d",&daynum,month,&year);
		for(i=0;i<19;i++)
		{
			if(!strcmp(month,a[i].H)) {
				monthnum=a[i].num;
				break;
			}
		}

		daytotal=year*365+monthnum*20+daynum;//今天之前已有的天数
		T_year=floor(daytotal/260);//T-year 13*20天/年
		T_num=(daytotal%260)%13;//默认从0-12计数,但实际上是1-13计数哦
		T_day=(daytotal%260)%20;//既然输入是“今天之前已有的天数”,那么输出也应该是这样的
	
		printf("%d %s %d\n",T_num+1,T[T_day],T_year);
	}
	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