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

我的结果没错啊,为什么是PE呢??哪位给看看怎么回事?!涉及输出的地方已注释标出!

Posted by zhenly at 2007-03-30 17:06:10 on Problem 1008
#include<stdio.h>
#include<string.h>
void main()
{
	int dom[19] = {20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,5};
	char hname[][10]= {"pop", "no", "zip","zotz", "tzec", "xul", "yoxkin", "mol", 
		"chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu","uayet"};
	int n,d,m,y,i,sum;
	char c,hmonth[10],tname[][10] = {"imix", "ik", "akbal", "kan", "chicchan", "cimi","manik", "lamat",
		"muluk", "ok", "chuen", "eb", "ben", "ix", "mem"," cib", "caban", "eznab", "canac", "ahau"}; 
	
         scanf("%d",&n);
	printf("%d\n",n);//输出n!!!!!!!!!!!!

	while( n-- > 0)
	{
		d = 0;i = 0;
		c = getchar();
		while((c = getchar())!='.')
		{
			d = d*10 + c - '0';
		}
		c = getchar();
		while((c = getchar())!=' ')
		{
			hmonth[i++]=c;
		}
		hmonth[i]='\0';
		
		i = 0;
		while(i<19)
		{
			if(!strcmp(hmonth,hname[i]))
			{
				m = i;break;
			}
			i++;
		}
		scanf("%d",&y);

		sum = 365 * y;
		for(i =0;i< m;i++)
			sum += dom[i];
		sum = sum + d + 1 ;

		y = 0;
		while(sum - y*260 > 260)
			y ++;
		d = sum;
		while(d - 13 > 0)
			d -= 13; 
		m = (sum-1)%20;

		printf("%d %s %d\n",d,tname[m],y);//输出!!!!!!

	}
}

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