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? 代码有点复杂

Posted by alfred at 2006-03-04 14:26:53 on Problem 1008
#include<stdio.h>
#include<string.h>
void main(){
	int times,i,day,year;
	int Tday,Tyear;
	char month[7];         
	char nameday[20][10]={"ahau","imix","ik","akbal","kan","chicchan","cimi",
		                  "manik","lamat","muluk","ok","chuen",
						  "eb","ben","ix","mem","cib","caban","eznab",
						  "canac"};
	scanf("%d",&times);
	printf("%d\n",times);
	for(i=0;i<times;i++){
		int days=0;
		scanf("%d. %s %d",&day,month,&year);
		days=year*365+day;
		if(strcmp(month,"pop")==0)	days+=0;
			if(strcmp(month,"no")==0)	days+=20;
			if(strcmp(month,"zip")==0)	days+=40;
			if(strcmp(month,"zotz")==0)	days+=60;
			if(strcmp(month,"tzec")==0)	days+=80;
			if(strcmp(month,"xul")==0)	days+=100;
			if(strcmp(month,"yoxkin")==0)	days+=120;
			if(strcmp(month,"mol")==0)	days+=140;
			if(strcmp(month,"chen")==0)	days+=160;
			if(strcmp(month,"yax")==0)	days+=180;
			if(strcmp(month,"zac")==0)	days+=200;
			if(strcmp(month,"ceh")==0)	days+=220;
			if(strcmp(month,"mac")==0)	days+=240;
			if(strcmp(month,"kankin")==0)	days+=260;
			if(strcmp(month,"muan")==0)	days+=280;
			if(strcmp(month,"pax")==0)	days+=300;
			if(strcmp(month,"koyab")==0)	days+=320;
			if(strcmp(month,"cumbu")==0)	days+=340;
			if(strcmp(month,"uayet")==0)	days+=360;
			Tyear=days/260;
			Tday=days%13+1;
			int k=(days+1)%20;
			printf("%d %s %d\n",Tday,nameday[k],Tyear);

	}	 
}




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