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

求助!!(这个程序实在不知道哪错了,提交了N次,都是WA!非常感谢!!)

Posted by zhuye626 at 2006-08-14 16:20:42 on Problem 1008
#include "stdio.h"
#include "string.h"
int main()
	{int i,n,day,month,Y,num,lchar,days,year;
	 char a[10],p[10];
	 scanf("%d",&n);
	 printf("%d\n",n);
	 for(i=0;i<n;i++)
	    {scanf("%d. %s %d",&day,a,&year);
		 if(strcmp(a,"uayet")==0)  month=18;
	     else if(strcmp(a,"cumhu")==0)  month=17;
	     else if(strcmp(a,"koyab")==0)  month=16;
	     else if(strcmp(a,"pax")==0)  month=15;
	     else if(strcmp(a,"muan")==0)  month=14;
	     else if(strcmp(a,"kankin")==0)  month=13;
	     else if(strcmp(a,"mac")==0)  month=12;
	     else if(strcmp(a,"ceh")==0)  month=11;
	     else if(strcmp(a,"zac")==0)  month=10;
	     else if(strcmp(a,"yax")==0)  month=9;
	     else if(strcmp(a,"chen")==0)  month=8;
	     else if(strcmp(a,"mol")==0)  month=7;
	     else if(strcmp(a,"yoxkin")==0)  month=6;
	     else if(strcmp(a,"xul")==0)  month=5;
	     else if(strcmp(a,"tzec")==0)  month=4;
	     else if(strcmp(a,"zotz")==0)  month=3;
	     else if(strcmp(a,"zip")==0)  month=2;
	     else if(strcmp(a,"no")==0)  month=1;
	     else if(strcmp(a,"pop")==0)  month=0;
	     days=year*365+month*20+day+1;
	     Y=days/260;
		 if(days%260==0)
			 Y--;
		 num=days%13;
		 if(num==0)  num=13;
	     lchar=days%20;
	     switch(lchar)
	       {case 0: strcpy(p,"ahau");break;
	        case 1: strcpy(p,"imix");break;
	        case 2: strcpy(p,"ik");break;
	        case 3: strcpy(p,"akbal");break;
	        case 4: strcpy(p,"kan");break;
	        case 5: strcpy(p,"chiccban");break;
	        case 6: strcpy(p,"cimi");break;
	        case 7: strcpy(p,"manik");break;
	        case 8: strcpy(p,"lamat");break;
                 case 9: strcpy(p,"muluk");break;
	        case 10:strcpy(p,"ok");break;
	        case 11:strcpy(p,"chuen");break;
	        case 12:strcpy(p,"eb");break;
	        case 13:strcpy(p,"ben");break;
	        case 14:strcpy(p,"ix");break;
	        case 15:strcpy(p,"mem");break;
	        case 16:strcpy(p,"cib");break;
	        case 17:strcpy(p,"caban");break;
	        case 18:strcpy(p,"eznab");break;
	        case 19:strcpy(p,"canac");break;
	       }
	     printf("%d %s %d\n",num,p,Y);
	    }
	 return 1;
} 


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