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

为什么老是Rumtime ERROR!请高手指教!

Posted by jiaguangsai at 2011-11-07 16:11:30 on Problem 1008
#include<stdio.h>
#include<string.h>
void main()
{
	char str1[20][5],str2[20][10];
	int n,b[20],i,j,years,days,month,count[20];
	char month1[20][10]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};
    char month2[20][10]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
    scanf("%d",&n);
	for(i=0;i<n;i++)
	{
        scanf("%s %s %d",str1[i],str2[i],&b[i]);
	}
	for(i=0;i<n;i++)
	{
		j=0;
		count[i]=365*b[i];
		if(strcmp(str2[i],month1[0])==0);
		else if(strcmp(str2[i],month1[1])==0)count[i]+=20;
		else if(strcmp(str2[i],month1[2])==0)count[i]+=40;
		else if(strcmp(str2[i],month1[3])==0)count[i]+=60;
		else if(strcmp(str2[i],month1[4])==0)count[i]+=80;
		else if(strcmp(str2[i],month1[5])==0)count[i]+=100;
		else if(strcmp(str2[i],month1[6])==0)count[i]+=120;
		else if(strcmp(str2[i],month1[7])==0)count[i]+=140;
		else if(strcmp(str2[i],month1[8])==0)count[i]+=160;
		else if(strcmp(str2[i],month1[9])==0)count[i]+=180;
		else if(strcmp(str2[i],month1[10])==0)count[i]+=200;
		else if(strcmp(str2[i],month1[11])==0)count[i]+=220;
		else if(strcmp(str2[i],month1[12])==0)count[i]+=240;
		else if(strcmp(str2[i],month1[13])==0)count[i]+=260;
		else if(strcmp(str2[i],month1[14])==0)count[i]+=280;
		else if(strcmp(str2[i],month1[15])==0)count[i]+=300;
		else if(strcmp(str2[i],month1[16])==0)count[i]+=320;
		else if(strcmp(str2[i],month1[17])==0)count[i]+=340;
		else if(strcmp(str2[i],month1[18])==0)count[i]+=360;
		while(str1[i][j]!='.')
		{
			j++;
		}
		if(j==2)count[i]=count[i]+(str1[i][j-1]-'0')+(str1[i][j-2]-'0')*10;
		else count[i]=count[i]+(str1[i][j-1]-'0');
	}
	printf("%d\n",n);
	for(i=0;i<n;i++)
	{
		years=count[i]/260;
		days=count[i]%260;
		month=days%20;
		days=days%13;
		printf("%d %s %d\n",days+1,month2[month],years);
	}
	
}

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