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

Re:SOS 那位高手来帮我看看啊!!!!哪里错了啊~~~

Posted by 393783046 at 2007-12-06 22:15:20 on Problem 1008
In Reply To:SOS 那位高手来帮我看看啊 Posted by:393783046 at 2007-12-06 22:14:39
Source Code

Problem: 1008  User: 393783046 
Memory: N/A  Time: N/A 
Language: C  Result: Runtime Error 

Source Code 
#include<stdio.h>
#include<string.h>



void cx(int a,char b[8],int c)
{
		int e,g,h;
		long int f;
		if(strcmp(b,"pop")==0)
		{
			e=0;
		}
		else if(strcmp(b,"no")==0)
		{
			e=1;
		}
		else if(strcmp(b,"zip")==0)
		{
			e=2;
		}
		else if(strcmp(b,"zotz")==0)
		{
			e=3;
		}	
		else if(strcmp(b,"tzec")==0)
		{
			e=4;
		}
		else if(strcmp(b,"xul")==0)
		{
			e=5;
		}
		else if(strcmp(b,"yoxkin")==0)
		{
			e=6;
		}
		else if(strcmp(b,"mol")==0)
		{
			e=7;
		}
		else if(strcmp(b,"chen")==0)
		{
			e=8;
		}
		else if(strcmp(b,"yax")==0)
		{
			e=9;
		}	
		else if(strcmp(b,"zac")==0)
		{
			e=10;
		}
		else if(strcmp(b,"ceh")==0)
		{
			e=11;
		}
		else if(strcmp(b,"mac")==0)
		{
			e=12;
		}
		else if(strcmp(b,"kankin")==0)
		{
			e=13;
		}
		else if(strcmp(b,"muan")==0)
		{
			e=14;
		}
		else if(strcmp(b,"pax")==0)
		{
			e=15;
		}
		else if(strcmp(b,"koyab")==0)
		{
			e=16;
		}
		else if(strcmp(b,"cumhu")==0)
		{
			e=17;
		}
		else if(strcmp(b,"uayet")==0)
		{
			e=18;
		}

		if(e==18)
		{
			f=360+a+1+c*365;
		}
		else if(e<18)
		{
			f=e*20+a+1+c*365;
		}
		if(f%13==0)
			g=13;
		else
			g=f%13;
		h=f%20;
		if(f%260==0)
			c=f/260-1;
		else
			c=f/260;
		switch(h)
		{
		case 1:
			printf("%d imix %d\n",g,c);
			break;
		case 2:
			printf("%d ik %d\n",g,c);
			break;
		case 3:
			printf("%d akbal %d\n",g,c);
			break;
		case 4:
			printf("%d kan %d\n",g,c);
			break;
		case 5:
			printf("%d chicchan %d\n",g,c);
			break;
		case 6:
			printf("%d cimi %d\n",g,c);
			break;
		case 7:
			printf("%d manik %d\n",g,c);
			break;
		case 8:
			printf("%d lamat %d\n",g,c);
			break;
		case 9:
			printf("%d muluk %d\n",g,c);
			break;
		case 10:
			printf("%d ok %d",g,c);
			break;
		case 11:
			printf("%d chuen %d\n",g,c);
			break;
		case 12:
			printf("%d eb %d\n",g,c);
			break;
		case 13:
			printf("%d ben %d\n",g,c);
			break;
		case 14:
			printf("%d ix %d\n",g,c);
			break;
		case 15:
			printf("%d mem %d\n",g,c);
			break;
		case 16:
			printf("%d cib %d\n",g,c);
			break;
		case 17:
			printf("%d caban %d\n",g,c);
			break;
		case 18:
			printf("%d eznab %d\n",g,c);
			break;
		case 19:
			printf("%d canac %d\n",g,c);
			break;
		case 0:
			printf("%d ahau %d\n",g,c);
			break;
		}
}
int main(void)
{
	int n,i;
	int a[7000],c[7000];
	char b[8][7000];
	scanf("%d",&n);
	
	for(i=0;i<n;i++)
	{
		scanf("%d.%s %d",&a[i],&b[i],&c[i]);
	}
	printf("%d\n",n);
	for(i=0;i<n;i++)
	{
		cx(a[i],b[i],c[i]);
	}
	
	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