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 476367795 at 2008-10-19 17:15:09 on Problem 1008
#include<iostream>
#include<string>
using namespace std;
	

	int main()
	{
		
		string A[20] =	{ "pop" , "no" , "zip" ,  "zotz" ,  "tzec" , " xul" ,  "yoxkin" ,  "mol",   "chen" , 
		"yax" , "zac" ,  "ceh" ,  "mac" ,  "kankin" ,  "muan" ,  "pax" ,  "koyab" ,  "cumhu" , "uayet" };

		string B[]={"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk",
				"ok", "chuen","eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"};


	
		int num;
		cin >> num;
		cout<<num<<endl;
	
		

		while(num--)
		{
			
		string Haabday,Haabmonth;
		int Day,Haabyear;
		cin>>Haabday>>Haabmonth>>Haabyear;
			
		if ( Haabday.length() == 2 )
			Day= Haabday[0]-48+1;
		if ( Haabday.length() == 3 )
			Day = (Haabday[0]-48)*10+Haabday[1]-48+1;
			
			int i,n;
			for (i=0;i<20;i++)
			{
				if (Haabmonth==A[i])
				{ n = i;break; }
				
			}
		
			int amount=Day+n*20+Haabyear*365;
			
		



			int Tzolkinday;
			int Tzolkinyear;
			string Tzolkinmonth;
			
			
			
	
			if (amount == 0)
			{
				Tzolkinday =1; 
				Tzolkinyear = 0;
				Tzolkinmonth = "imix";
			}

			else
			{
				if(amount%260==0)
				{
					Tzolkinyear = amount/260-1;
					Tzolkinday = 13;
					Tzolkinmonth="ahau";
				}
				else
				{
					Tzolkinyear = amount/260;
					Tzolkinmonth=B[(amount%260)%20-1];
					if ( amount%13 == 0 )
						Tzolkinday = 13;
					else
						Tzolkinday = amount%13;
				}
			}
			
			
			
			

			cout<<Tzolkinday<<" "<<Tzolkinmonth<<" "<<Tzolkinyear<<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