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 Jakceyl at 2006-05-06 12:59:09 on Problem 1008
#include<iostream.h>
#include<string.h>
void main()
{
	char*Haab[19]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen",
		"yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};
	char* Maya[20]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok",
		"chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
	int n,year,tag=0,sum,day;
	char month[9];
	char b;
	cin>>n;
	int *yearM=new int [n];
	int *dayM=new int [n];
	int *monthM=new int [n];
	for(int i=0;i<n;i++)
	{
		cin>>day>>b;
		cin>>month;
		cin>>year;
		if(year>=5000||year<0)
			return;
		while(tag<19)
		{
			if(strcmp(month,Haab[tag])==0)
				break;
			tag++;
		}
		if(year==0)
		{
			yearM[i]=0;
			sum=tag*20+day+1;
		}
		else
		{
			sum=year*365+tag*20+day+1;
			yearM[i]=sum/260;
		}
			sum=sum%260;
			if(sum%13==0)
				dayM[i]=13;
			else
				dayM[i]=(sum)%13;
			if(sum%20==0)
				monthM[i]=19;
			else
				monthM[i]=sum%20-1;
			tag=0;
	}
	cout<<n<<endl;
	for(int j=0;j<n;j++)
		cout<<dayM[j]<<" "<<Maya[monthM[j]]<<" "<<yearM[j]<<endl;	
}

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