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 wdestinyx at 2006-03-02 12:24:49 on Problem 1008
#include<iostream.h>

bool compare(char *m,int i);

char *monthN[19]={"pop","no","zip","zotz","tzec","xul","yoxkin",
		        "mol","chen","yax","zac","ceh","mac","kankin",
				"muan","pax","koyab","cumhu","uayet"};
	
char *dayN[20]={"imix","ik","akbal","kan","chicchan","cimi",
		        "manik","lamat","muluk","ok","chuen","eb","ben",
				"ix","mem","cib","caban","eznab","canac","ahau"};
void main()
{
	int time,days,dayH,yearH,dayT,yearT,n;
	char month[7],a;
	cin >> time;

	for(int i=0;i < time;i++)
	{
		cin >> dayH >> a >> month >> yearH;
                  days = yearH*365;
		for(int j=0;!compare(month,j);j++);
		days+=j*20+dayH;
                  yearT = days / 260;
		days = days - yearT*260;
		n = days%13+1;
		dayT = days%20;
                  cout << n << " " << dayN[dayT] << " " << yearT << endl;
	}
}

bool compare(char *m,int i)
{
	if(((int)m[0]==(int)monthN[i][0]) && ((int)m[1]==(int)monthN[i][1]))
		return true;
	else
		return false;
}


 

    


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