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

大家看看有什么问题?老是wrong answer

Posted by shark at 2003-10-01 15:42:03 on Problem 1008
#include <iostream>
#include <string>
 
const char Haab[21][10]={"","pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin",
						"mol", "chen", "yax", "zac", "ceh", "mac", "kankin", 
						"muan", "pax", "koyab", "cumhu","uayet"};
const int Haab_day[20]={0,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,5};
const char Tzolkin[21][10]={"","imix","ik","akbal","kan","chicchan","cimi",
							"manik","lamat","muluk","ok","chuen","eb","ben",
							"ix","mem","cib","caban","eznab","canac","ahau"};
int main()
{
	int year,day,i,j,k,n,m,output[10000][3];
	double d1;
	char month[10];
	long days;
	cin >>n;
	//cout <<n<<endl;
	for (m=0;m<n;m++)
	{
		cin >>d1>>month>>year;
		day=int(d1);
		day++;
		days=0;
		for (i=1;i<=20;i++)
		{
			if (strcmp(month,Haab[i])==0)
			{
				for (j=1;j<i;j++)
				{
					days=days+Haab_day[i];
				}
				break;
			}
		}
		days=days+year*365+day;
		if (days%260==0)
		{
			year=(days/260)-1;
			j=13;k=20;
		}
		else
		{
			year=days/260;
			days=days%260;
			j=1;k=1;
			for (i=2;i<=days;i++)
			{
				j++;
				if (j>13) 
				{
					j=1;
				}
				k++;
				if (k>20)
				{
					k=1;
				}
			}
		}
		output[m][0]=j;
		output[m][1]=k;
		output[m][2]=year;
		//cout <<j<<' '<<Tzolkin[k]<<' '<<year<<endl;
	}
	cout <<n<<endl;
	for (m=0;m<n;m++)
	{
		cout <<output[m][0]<<' '<<Tzolkin[output[m][1]]<<' '<<output[m][2]<<endl;
	}
	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