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

帮帮忙,可能问题太幼稚,没办法人笨就是这样的

Posted by 90401417 at 2004-12-05 09:31:29 on Problem 1008
这个程序为什么是WRONG ANSWER 啊?
谢谢了
#include<string.h>
#include<malloc.h>
#include<stdio.h>
struct haab{
	char m[10];}
ha[19]={{"pop"},{"no"},{"zip"},{"zotz"},{"tzec"},{"xul"},{"yoxkin"},{"mol"},
{"chen"},{"yax"},{"zac"},{"ceh"},{"mac"},{"kankin"},{"muan"},{"pax"},{"koyab"},{"cumhu"}};
struct tzolkin{
	char d[10];}
tz[20]={{"imix"},{"ik"},{"akbal"},{"kan"},{"chicchan"},{"cimi"},{"manik"},{"lamat"},{"muluk"},
{"ok"},{"chuen"},{"eb"},{"ben"},{"ix"},{"mem"},{"cib"},{"caban"},{"eznab"},{"canac"},{"ahau"}};
struct day{
	int d,y;
	char m[10];
};
void main () {
	struct day *p;
	int n,i,j,m,total;
	scanf("%d",&n);
	p=(struct day *)malloc(sizeof(day)*n);
	for(i=0;i<n;i++){
		scanf("%d. %s %d",&(p+i)->d,(p+i)->m,&(p+i)->y);
		if((p+i)->y>5000) goto end;
		for(j=0;j<19;j++){ 
			if(!(strcmp((p+i)->m,ha[j].m))) m=j;}
		total=((p+i)->d+1)+m*20+(p+i)->y*365;
		(p+i)->y=total/260;
		if(total%260%13!=0) (p+i)->d=(total%260%13);
		else (p+i)->d=13;
		if(total%260%20!=0) m=total%260%20-1;
		else m=20-1;
		strcpy((p+i)->m,tz[m].d);}
	printf("%d\n",n);
	for(i=0;i<n;i++){
		printf("%d %s %d\n",(p+i)->d,(p+i)->m,(p+i)->y);}

end:;}


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