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

麻烦帮我看一下为什么WA。用C写的。。。

Posted by sj159357 at 2014-05-10 15:12:32 on Problem 1008
#include <stdio.h>
#define N 1000
main()
{
	int j,i,year,day,sum[N],first[N],last[N],mid[N];
	char s[6];
	scanf("%d",&j);
	for(i=1;i<=j;i++)
	{
		scanf("%d. %s %d",&day,s,&year);
		if(day>=0&&day<=19&&year<5000&&strcmp(s,"pop")==0)
		{
			sum[i-1]=year*365+day;
		}
		if(day>=0&&day<=19&&year<5000&&strcmp(s,"no")==0)
		{
			sum[i-1]=year*365+20+day;
		}
		if(day>=0&&day<=19&&year<5000&&strcmp(s,"zip")==0)
		{
			sum[i-1]=year*365+40+day;
		}
		if(day>=0&&day<=19&&year<5000&&strcmp(s,"cotz")==0)
		{
			sum[i-1]=year*365+60+day;
		}
		if(day>=0&&day<=19&&year<500&&strcmp(s,"tzec")==0)
		{
			sum[i-1]=year*365+80+day;
		}
		if(day>=0&&day<=19&&year<5000&&strcmp(s,"xul")==0)
		{
			sum[i-1]=year*365+100+day;
		}
		if(day>=0&&day<=19&&year<5000&&strcmp(s,"yoxkin")==0)
		{
			sum[i-1]=year*365+120+day;
		}
		if(day>=0&&day<=19&&year<5000&&strcmp(s,"mol")==0)
		{
			sum[i-1]=year*365+140+day;
		}
		if(day>=0&&day<=19&&year<5000&&strcmp(s,"chen")==0)
		{
			sum[i-1]=year*365+160+day;
		}
		if(day>=0&&day<=19&&year<5000&&strcmp(s,"yax")==0)
		{
			sum[i-1]=year*365+180+day;
		}
		if(day>=0&&day<=19&&year<5000&&strcmp(s,"zac")==0)
		{
			sum[i-1]=year*365+200+day;
		}
		if(day>=0&&day<=19&&year<5000&&strcmp(s,"ceh")==0)
		{
			sum[i-1]=year*365+220+day;
		}
		if(day>=0&&day<=19&&year<5000&&strcmp(s,"mac")==0)
		{
			sum[i-1]=year*365+240+day;
		}
		if(day>=0&&day<=19&&year<5000&&strcmp(s,"kankin")==0)
		{
			sum[i-1]=year*365+260+day;
		}
		if(day>=0&&day<=19&&year<5000&&strcmp(s,"muan")==0)
		{
			sum[i-1]=year*365+280+day;
		}
		if(day>=0&&day<=19&&year<5000&&strcmp(s,"pax")==0)
		{
			sum[i-1]=year*365+300+day;
		}
		if(day>=0&&day<=19&&year<5000&&strcmp(s,"koyab")==0)
		{
			sum[i-1]=year*365+320+day;
		}
		if(day>=0&&day<=19&&year<5000&&strcmp(s,"cumhu")==0)
		{
			sum[i-1]=year*365+340+day;
		}
		if(day>=0&&day<=4&&year<5000&&strcmp(s,"uayet")==0)
		{
			sum[i-1]=year*365+360+day;
		}
	}
	printf("%d\n",j);
	for(i=0;i<j;i++)
	{
		last[i]=sum[i]/(13*20);
		mid[i]=sum[i]%20;
		first[i]=sum[i]%13+1;
		switch(mid[i])
		{
		case 0:
			printf("%d imix %d\n",first[i],last[i]);
			break;
		case 1:
			printf("%d ik %d\n",first[i],last[i]);
			break;
		case 2:
			printf("%d akbal %d\n",first[i],last[i]);
			break;
		case 3:
			printf("%d kan %d\n",first[i],last[i]);
			break;
		case 4:
			printf("%d chicchan %d\n",first[i],last[i]);
			break;
		case 5:
			printf("%d cimi %d\n",first[i],last[i]);
			break;
		case 6:
			printf("%d manik %d\n",first[i],last[i]);
			break;
		case 7:
			printf("%d lamat %d\n",first[i],last[i]);
			break;
		case 8:
			printf("%d muluk %d\n",first[i],last[i]);
			break;
		case 9:
			printf("%d ok %d\n",first[i],last[i]);
			break;
		case 10:
			printf("%d chuen %d\n",first[i],last[i]);
			break;
		case 11:
			printf("%d eb %d\n",first[i],last[i]);
			break;
		case 12:
			printf("%d ben %d\n",first[i],last[i]);
			break;
		case 13:
			printf("%d ix %d\n",first[i],last[i]);
			break;
		case 14:
			printf("%d mem %d\n",first[i],last[i]);
			break;
		case 15:
			printf("%d cib %d\n",first[i],last[i]);
			break;
		case 16:
			printf("%d caban %d\n",first[i],last[i]);
			break;
		case 17:
			printf("%d eznab %d\n",first[i],last[i]);
			break;
		case 18:
			printf("%d canac %d\n",first[i],last[i]);
			break;
		case 19:
			printf("%d ahau %d\n",first[i],last[i]);
			break;
		}
	}
}

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