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 REX at 2005-03-06 17:21:10 on Problem 1008
#include<iostream.h>
#include<string.h>
struct Haab
{
	int day,month,year;
};
struct Tzolkin
{
	int day,month,year;
};
void main()
{
	int t,i,j,*Sum;
	char point,monHaab[10];
	char monthHaab[20][10]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};
	char monthTzolkin[20][10]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
	Haab *pHaab;
	Tzolkin *pTzolkin;
	cin>>t;
	Sum=new int[t];
	pHaab=new Haab[t];
	pTzolkin=new Tzolkin[t];
	for(i=0;i<t;i++)
	{
		cin>>pHaab[i].day;
		pHaab[i].day+=1;
		cin>>point;
		cin>>monHaab;
		for(j=0;j<19;j++)
		{
			if(!strcmp(monHaab,monthHaab[j]))
			{
				pHaab[i].month =j;
				break;
			}
		}		
		cin>>pHaab[i].year;
		Sum[i]=pHaab[i].day+20*pHaab[i].month+365*pHaab[i].year;
	}
	cout<<t<<endl;
	for(i=0;i<t;i++)
	{
		pTzolkin[i].year =Sum[i]/260;
		pTzolkin[i].month =Sum[i]%20;
		if(pTzolkin[i].month==0)
			pTzolkin[i].month=20;
		pTzolkin[i].day =Sum[i]%13;
		if(pTzolkin[i].day ==0)
			pTzolkin[i].day =13;
		cout<<pTzolkin[i].day <<" "<<monthTzolkin[pTzolkin[i].month-1]<<" "<<pTzolkin[i].year <<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