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

y?

Posted by re_bluemoon at 2006-10-19 12:52:08 on Problem 1008
#include<iostream>
#include<string>
using namespace std;
int change(string ee)
{
	if(ee=="pop") return 0;
	if(ee=="no") return 1;
	if(ee=="zip") return 2;
	if(ee=="zotz") return 3;
	if(ee=="tzec") return 4;
	if(ee=="xul") return 5;
	if(ee=="yoxkin") return 6;
	if(ee=="mol") return 7;
	if(ee=="chen") return 8;
	if(ee=="yax") return 9;
	if(ee=="zac") return 10;
	if(ee=="ceh")return 11;
	if(ee=="mac") return 12;
	if(ee=="kankin") return 13;
	if(ee=="muan") return 14;
	if(ee=="pax") return 15;
	if(ee=="koyab") return 16;
	if(ee=="cumhu") return 17;
	if(ee=="uayet") return 18;
}
string ch(int mm)
{
	if(mm==1) return "imix";
	if(mm==2) return "ik";
	if(mm==3) return "akbal";
	if(mm==4) return "kan";
	if(mm==5) return "chicchan";
	if(mm==6) return "cimi";
	if(mm==7) return "manik";
	if(mm==8) return "lamat";
	if(mm==9) return "muluk";
	if(mm==10) return "ok";
	if(mm==11) return "chuen";
	if(mm==12) return "eb";
	if(mm==13) return "ben";
	if(mm==14) return "ix";
	if(mm==15) return "mem";
	if(mm==16) return "cib";
	if(mm==17) return "caban";
	if(mm==18) return "eznab";
	if(mm==19) return "canac";
	if(mm==0) return "ahau";
}
void main()
{
	int num;
	cin>>num;
	string* days=new string[num];
	int* year=new int[num];
	int* day=new int[num];
	cout << num <<endl;
	for(int i=0;i<num;i++)
	{
		cin >> days[i];
		int j=0;
		int fday=0;
		while(days[i][j]>='0'&&days[i][j]<='9') j++;
		string dd=days[i].substr(0,j);
		string ee=days[i].substr(j+1,days[i].length());
		fday=atoi(dd.c_str());
		cin >> year[i];
		day[i]=year[i]*365+fday+change(ee)*20;
		int  yy=day[i]/260;
		int  mm=(day[i]+1)%20;
		int  ddd=day[i]%13+1;
		cout << ddd << " " << ch(mm) <<" " << yy <<endl;
	}
	delete[] days;
	delete[] day;
	delete[] year;
}

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