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 bslcy at 2005-08-17 16:18:56 on Problem 1008
为什么我的这个程序总是错!
#include <stdio.h>
#include <string.h>
const char a[19][7]={
	"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};
const char b[20][9]={
	"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};

int main()
{
	int n,i,j,k,day,year;
	long sum;
	char d[7]={0};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
	   scanf("%d. %s %d",&day,d,&year);
	   if(i==0) printf("%d\n",n);
	   for(j=0;j<19;j++)
	   {
		   if(strcmp(a[j],d)==0)
		   {
			 k=j;
			 break;
		   }
	   }
       sum=(long)year*365+(long)day+(long)k*20+1;
	   year=sum/260;
       k=sum-260*(long)year;
	   day=k%13;
	   if(day==0) day=13;
	   k=k%20;
	   if(k==0) k=20;
       printf("%d %s %d\n",day,b[k-1],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