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

让我最伤心的事...莫过于在VC上成功了,但提交就是WA啊!!!这年头A题不容易啊。

Posted by qichao at 2009-07-22 16:06:36 on Problem 1008
#include<stdio.h>
#include<string.h>

int main()
{
	long int day;
	int day1,day2,i,year1,year2,n;
	char mon1[7],mon2[9];
	char month1[19][7]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};
	char month2[21][9]={"00","imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
	scanf("%d",&n);
	while(n--)
	{
		scanf("%d. %s %d",&day1,mon1,&year1);
		for(i=0;i<19;i++)
			if(strcmp(mon1,month1[i])==0)
				break;
		day=year1*365+20*i+day1+1;
		if(day%260!=0)
			year2=day/260;
		else
		{
			year2=day/260-1;
			printf("13 ahau %d\n",year2);
			continue;
		}
		day=day%260;
		if(day%20==0)
			strcpy(mon2,month2[20]);
		else
			strcpy(mon2,month2[day%20]);
		if(day%13==0)
			day2=13;
		else
			day2=day%13;
		printf("%d %s %d\n",day2,mon2,year2);
	}
}

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