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 willanthy at 2005-07-26 17:06:05 on Problem 1008
#include "stdio.h"
#include "string.h"
void convert ( long day , long month , long year )
{
	long c_day , c_number , c_year ;
	long count , temp_1 ;
	count = year * 365 + ( month-1 ) * 20 + day ;
	c_year = count / 260 ;
	temp_1 = count % 260 ;
	c_number = temp_1 % 13 ;
	c_day = temp_1 % 20 ;
	printf ( "%d " , c_number ) ;
	switch ( c_day )
	{
		case 1 : printf ("imix " );break ;
		case 2 : printf ("ik " );break ;
		case 3 : printf ("akbal " );break ;
		case 4 : printf ("kan " );break ;
		case 5 : printf ("chicchan " );break ;
		case 6 : printf ("cimi " );break ;
		case 7 : printf ("manik " );break ;
		case 8 : printf ("lamat " );break ;
		case 9 : printf ("muluk " );break ;
		case 10 : printf ("ok " );break ;
		case 11 : printf ("chuen " );break ;
		case 12 : printf ("eb " );break ;
		case 13 : printf ("ben " );break ;
		case 14 : printf ("ix " );break ;
		case 15 : printf ("mem " );break ;
		case 16 : printf ("cib " );break ;
		case 17 : printf ("caban " );break ;
		case 18 : printf ("eznab " );break ;
		case 19 : printf ("canac " );break ;
		case 20 : printf ("ahau " );break ;
	};
	printf ( "%d\n" , c_year) ;
}
int main ( )
{
	int i , j ; 
	long day , year , month ;
	char a[8] ;
	scanf ("%d" , &i ) ;
	printf ("%d\n" , i ) ;
	while ( i -- )
	{
		fflush(stdin) ;
		scanf ( "%ld." , &day ) ;
		scanf ( "%s" , a ) ;
		scanf ( "%ld" , &year ) ;
		if ( strcmp ( a , "pop" ) == 0 )
		{
			month = 1 ;
			goto line1 ; 
		}
		if ( strcmp ( a , "no" ) == 0 )
		{
			month = 2 ;
			goto line1 ; 
		}
		if ( strcmp ( a , "zip" ) == 0 )
		{
			month = 3 ;
			goto line1 ; 
		}
		if ( strcmp ( a , "zotz" ) == 0 )
		{
			month = 4 ;
			goto line1 ; 
		}
		if ( strcmp ( a , "tzec" ) == 0 )
		{
			month = 5 ;
			goto line1 ; 
		}
		if ( strcmp ( a , "xul" ) == 0 )
		{
			month = 6 ;
			goto line1 ; 
		}
		if ( strcmp ( a , "yoxkin" ) == 0 )
		{
			month = 7 ;
			goto line1 ; 
		}
		if ( strcmp ( a , "mol" ) == 0 )
		{
			month = 8 ;
			goto line1 ; 
		}
		if ( strcmp ( a , "chen" ) == 0 )
		{
			month = 9 ;
			goto line1 ; 
		}
		if ( strcmp ( a , "yax" ) == 0 )
		{
			month = 10 ;
			goto line1 ; 
		}
		if ( strcmp ( a , "zac" ) == 0 )
		{
			month = 11 ;
			goto line1 ;
		}
		if ( strcmp ( a , "ceh" ) == 0 )
		{
			month = 12 ;
			goto line1 ;
		}
		if ( strcmp ( a , "mac" ) == 0 )
		{
			month = 13 ;
			goto line1 ;
		}
		if ( strcmp ( a , "kankin" ) == 0 )
		{
			month = 14 ;
			goto line1 ;
		}
		if ( strcmp ( a , "muan" ) == 0 )
		{
			month = 15 ;
			goto line1 ;
		}
		if ( strcmp ( a , "pax" ) == 0 )
		{
			month = 16 ;
			goto line1 ;
		}
		if ( strcmp ( a , "koyab" ) == 0 )
		{
			month = 17 ;
			goto line1 ;
		}
		if ( strcmp ( a , "cumhu" ) == 0 )
		{
			month = 18 ;
			goto line1 ;
		}
		if ( strcmp ( a , "uayet" ) == 0 )
		{
			month = 19 ;
			goto line1 ;
		}
	line1:
		convert ( day+1 , month , 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