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

郁闷ing!!!怎么一直wrong啊?兄弟们救救我啊!

Posted by acmcc at 2004-05-06 17:40:53 on Problem 1008
#include<stdio.h>
#include<string.h>
void main()
{
	char hmon[1],tmon[1];
	long hyear,tyear;
	int hday,tday;
	unsigned long total;
	int n,i,m=0,tmpmon;
	scanf("%d",&n);
	printf("%d\n",n);
	for(i=0;i<n;i++)
	{
		scanf("%d.%s%d",&hday,hmon,&hyear);
		if(!strcmp(hmon,"pop"))          m=1;
		else if(!strcmp(hmon,"no"))      m=2;
		else if(!strcmp(hmon,"zip"))     m=3;
		else if(!strcmp(hmon,"zotz"))    m=4;
		else if(!strcmp(hmon,"tzec"))    m=5;
		else if(!strcmp(hmon,"xul"))     m=6;
		else if(!strcmp(hmon,"yoxkin"))  m=7;
		else if(!strcmp(hmon,"mol"))     m=8;
		else if(!strcmp(hmon,"chen"))    m=9;
		else if(!strcmp(hmon,"yax"))     m=10;
		else if(!strcmp(hmon,"zac"))     m=11;
		else if(!strcmp(hmon,"ceh"))     m=12;
		else if(!strcmp(hmon,"mac"))     m=13;
		else if(!strcmp(hmon,"kankin"))  m=14;
		else if(!strcmp(hmon,"muan"))    m=15;
		else if(!strcmp(hmon,"pax"))     m=16;
		else if(!strcmp(hmon,"koyab"))   m=17;
		else if(!strcmp(hmon,"cumhu"))   m=18;
		else if(!strcmp(hmon,"uayet"))   m=19;
                  total=hyear*365+20*(m-1)+hday+1;
		tyear=(total-1)/260;
		total%=260;
		if(total==0) 
		{
			printf("13 ahau %d\n",tyear);
			continue;
		}
		tday=total%13; 
		if(tday==0) tday=13;
		tmpmon=total%20;
		switch(tmpmon)
		{
		case 0:  strcpy(tmon,"ahau");     break;
		case 1:  strcpy(tmon,"imix");     break;
		case 2:  strcpy(tmon,"ik");       break;
		case 3:  strcpy(tmon,"akbal");    break;
		case 4:  strcpy(tmon,"kan");      break;
		case 5:  strcpy(tmon,"chicchan"); break;
		case 6:  strcpy(tmon,"cimi");     break;
		case 7:  strcpy(tmon,"manik");    break;
		case 8:  strcpy(tmon,"lamat");    break;
		case 9:  strcpy(tmon,"muluk");    break;
		case 10: strcpy(tmon,"ok");       break;
		case 11: strcpy(tmon,"chuen");    break;
		case 12: strcpy(tmon,"eb");       break;
		case 13: strcpy(tmon,"ben");      break;
		case 14: strcpy(tmon,"ix");       break;
		case 15: strcpy(tmon,"mem");      break;
		case 16: strcpy(tmon,"cib");      break;
		case 17: strcpy(tmon,"caban");    break;
		case 18: strcpy(tmon,"eznab");    break;
		case 19: strcpy(tmon,"canac");    break;
		}
		printf("%d %s %d\n",tday,tmon,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