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

Re:帮忙看看哪里错了

Posted by 19850910 at 2005-03-04 22:55:12 on Problem 1008
In Reply To:帮忙看看哪里错了 Posted by:19850910 at 2005-03-04 22:31:03
#include<iostream.h>
#include<string.h>

int main()
{
	int t;
	int d[20],m[20],y[20],amount,d1,m1,y1;
	char month[20][7];
	cin>>t;	
	char mon1[19][7]={"pop","no","zip","zotz","tzec","xul", "yoxkin", "mol",
		"chen", "yax", "zac", "ceh", "mac", "kankin", "muan", 
		"pax", "koyab", "cumhu","uayet"};
	char mon2[20][10]={"imix", "ik", "akbal", "kan", "chicchan", 
		"cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", 
		"ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"};
	for(int k=0;k<t;k++)
    {
		cin>>d[k]>>month[k]>>month[k]>>y[k];
	}
	cout<<t<<endl;
	for(int j=0;j<t;j++)
	{
		
		for(int i=0;i<19;i++)
		{
			m[j]=i+1;
			if(!(strcmp(month[j],mon1[i]))) break;		
		}
		amount=y[j]*365+(m[j]-1)*20+d[j]+1;
				y1=(amount-1)/260;
		m1=(amount%260)%20;
		d1=(amount%260)%13;
		if(m1==0) m1=20;
		if(d1==0) d1=13;
		cout<<d1<<" "<<mon2[m1-1]<<" "<<y1<<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