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 IC0590501432 at 2005-12-04 10:50:01 on Problem 1008
#include<stdio.h>
#include<string.h>
void main(){
	int n,i,date,year,sum,nmonth,year1,month1,date1;
	char month[7];
	scanf("%d",&n);
	printf("%d",n);
	for(i=0;i<n;i++){
		scanf("%d.%s %d",&date,month,&year);
	    if (strcmp(month, "pop")==0)
		   	nmonth=0;
		if(strcmp(month,"no")==0)
			nmonth=1;
		if(strcmp(month,"zip")==0)
			nmonth=2;
		if(strcmp(month,"zotz")==0)
			nmonth=3;
		if(strcmp(month,"tzec")==0)
	     	nmonth=4;
		if(strcmp(month,"xul")==0)
			nmonth=5;
		if(strcmp(month,"yoxkin")==0)
			nmonth=6;
		if(strcmp(month,"mol")==0)
			nmonth=7;
		if(strcmp(month,"chen")==0)
			nmonth=8;
		if(strcmp(month,"yax")==0)
			nmonth=9;
		if(strcmp(month,"zac")==0)
			nmonth=10;
		if(strcmp(month,"ceh")==0)
			nmonth=11;
		if(strcmp(month,"mac")==0)
			nmonth=12;
		if(strcmp(month,"kankin")==0)
			nmonth=13;
		if(strcmp(month,"muan")==0)
			nmonth=14;
		if(strcmp(month,"pax")==0)
			nmonth=15;
		if(strcmp(month,"koyab")==0)
			nmonth=16;
		if(strcmp(month,"cumhu")==0)
			nmonth=17;
		if(strcmp(month,"uayet")==0)
			nmonth=18;
		sum=year*365+nmonth*20+date+1;
		year1=sum/260;
		month1=(int)(sum-year1*260)%20;
		date1=(sum-year1*260)%13;
		 
		switch(month1){
		    case 0:
		    	printf("%d ahau %d\n",date1,year1);
				break;
            case 1:
				printf("%d imix %d\n",date1,year1);
				break;
			case 2:
				printf("%d ik %d\n",date1,year1);
				break;
			case 3:
				printf("%d akbal %d\n",date1,year1);
				break;
			case 4:
				printf("%d kan %d\n",date1,year1);
				break;
			case 5:
				printf("%d chicchan %d\n",date1,year1);
				break;
			case 6:
				printf("%d cimi %d\n",date1,year1);
				break;
			case 7:
				printf("%d manik %d\n",date1,year1);
				break;
			case 8:
				printf("%d lamat %d\n",date1,year1);
				break;
			case 9:
				printf("%d muluk %d\n",date1,year1);
				break;
			case 10:
				printf("%d ok %d\n",date1,year1);
				break;
			case 11:
				printf("%d chuen %d\n",date1,year1);
				break;
			case 12:
				printf("%d eb %d\n",date1,year1);
				break;
			case 13:
				printf("%d ben %d\n",date1,year1);
				break;
			case 14:
				printf("%d ix %d\n",date1,year1);
				break;
			case 15:
				printf("%d mem %d\n",date1,year1);
				break;
			case 16:
				printf("%d cib %d\n",date1,year1);
				break;
			case 17:
				printf("%d caban %d\n",date1,year1);
				break;
			case 18:
				printf("%d eznab %d\n",date1,year1);
				break;
			case 19:
				printf("%d canac %d\n",date1,year1);
				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