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 NinjaQ at 2005-03-11 10:59:31 on Problem 1008
#include <stdio.h>
#include <string.h>

char *month[]={"pop", "no", "zip", "zotz", "tzec", "xul", 
				"yoxkin", "mol", "chen", "yax", "zac", "ceh", 
				"mac", "kankin", "muan", "pax", "koyab", "cumhu","uayet"};
char *period[]={"imix", "ik", "akbal", "kan", "chicchan", 
				"cimi", "manik", "lamat", "muluk", "ok", 
				"chuen", "eb", "ben", "ix", "mem", 
				"cib","caban", "eznab", "canac", "ahau"};
void main()
{
	int n,j;
	int d=0,m=0,y=0;
	int sum;
	int pe,lo,ye;
	char p[20];
	scanf("%d",&n);
	printf("%d\n",n);
	while(n--)
	{
		scanf("%d. %s %d",&d,p,&y);
		for (j=0;j<19;j++)
		         if (strcmp(p,month[j])==0)
				break;
		m=j;
		sum=y*365+m*20+d+1;
		ye=sum/260;
		sum=sum-ye*260;
		if (sum==0)
		{ye--;sum=260;}
		pe=sum%13;
		if (pe==0)
			pe=13;
		lo=sum%20-1;
		if (lo<0)
			lo=19;
		printf("%d %s %d\n",pe,period[lo],ye);
	}
}

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