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 yejian at 2009-07-19 20:15:00 on Problem 1008
 #include<stdio.h>
#include<string.h>
 
void change( int day, char *s,int year);
 
int main()

{	
	int day,year;
	char *s,a[10];
	int n;
	s=a;
	scanf("%d\n",&n);
 while(n--)
	{
	scanf("%d.%s%d",&day,a,&year);
	change(day ,s,year);
    }
    
return 0;
}

void change(int day,char *s,int year) 
{	
 
	int  k=0,sum;
    int a,b,c;

	char *m[19]={"pop","no","zip","zotz","tzec", "xul","yoxkin","mol","chen","yax","zac",
		"ceh","mac","kankin","muan","pax","koyab","cumhu", "uayet"};

    char  *tm[20]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok", 
					"chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};	
    
 
	while(strcmp(s, m[k]))
		k++;
	sum=year*365+k*20+day;
	a=sum%13+1;
    b=sum%20;
	c= sum/260;
	printf("%d  %s  %d\n",a,tm[b],c);
}

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