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

1008真心不知道那里有问题啊。。。。求指导

Posted by cude at 2013-05-09 23:56:46 on Problem 1008
#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;
string haab[19]={"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", 
				"ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu","uayet"};
string holly[20]={"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", 
					"chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"};

int ha(int data,char month[],int year)
{
	int count=0,i;
	count+=365*year;
	count+=data+1;
	for(i=0;i<19;i++)
	{
		if(haab[i]==month)
			break;
	}
	count+=i*20;
	return count;
}

void ho(int count)
{
	int data,year;
	string month;
	year=count/260;
	count%=260;
	if(count==0)
	{
		year--;
		count=260;
	}
	data=count%13;
	if(data==0)
		data=13;
	int j=count%20;
	if(j==0)
		j=20;
	month=holly[j-1];
	cout<<data<<' '<<month<<' '<<year<<endl;
}

int main()
{
	int n,i,data,year;
	char month[20];
	while(cin>>n)
	{
		for(i=0;i<n;i++)
		{
			scanf("%d.%s%d",&data,month,&year);
			ho(ha(data,month,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