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 Checkcheck at 2005-12-03 00:20:39 on Problem 1008
#include <stdio.h>
#include <math.h>
#include <string.h>

int n,year,number,name;
char Haab[19][7]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen",
				  " yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};	
char Tzoltin[20][9]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok",
					 "chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};																																

long int readIn(){
	char day[4],month[7];
	long int i,y,length,m=0,total,p;
	scanf("%s%s%d",day,month,&y);
	length=strlen(day);
	total=y*365;
	for (i=0;i<length-1;i++)
		m=m*10+(day[i]-'0');
	for (i=0;i<18;i++){
		p=strcmp(month,Haab[i]);
		if (p==0) {
			total=total+20*i;
			break;
		}
	}
	if (i==18) total=total+360;
	total=total+m+1;
	printf("%d\n",total);
	return total;
}

void main(){
	int i;
	long int days;
	scanf("%d",&n);
	printf("%d\n",n);
	for (i=0;i<n;i++){
		days=readIn();
		year=(days-1)/260;
		days=(days-1)%260+1;
		number=(days-1)%13+1;
		name=(days-1)%20+1;
		printf("%d %s %d\n",number,Tzoltin[name-1],year);
	}
}

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