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 上可以正确运行,可以提交就是 runtime error,请帮忙看看吧,谢谢!

Posted by liuyun at 2008-02-02 22:32:04 on Problem 1008 and last updated at 2008-02-02 22:48:20
#include<stdio.h>
#include<string.h>
char HaabMonth[19][10]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};
char HollyName[20][10]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};

struct output
{
	int No;
	char *Name;
	int Year;
};

int main()
{
	int n,day,year,m,t,f;
	char s[10];
	struct output P[50];
	scanf("%d",&n);
	for(f=0;f<n;f++)
	{
		scanf("%d. %s %d",&day,s,&year);
		for(m=0;m<19;m++)
			if(strcmp(HaabMonth[m],s)==0)
				break;
		t=day+20*m+365*year;  
		P[f].No=1+t%13;
		P[f].Name=HollyName[t%20];
		P[f].Year=t/260;
	}
	printf("%d\n",n);
	for(f=0;f<n;f++)
		printf("%d %s %d\n",P[f].No,P[f].Name,P[f].Year);
	return 0;
}

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