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

为什么我得到的老是Wrong Answer,哪位大神帮我看看吧,非常感谢啊

Posted by dengdefang at 2011-09-07 19:17:11 on Problem 1008
#include<iostream>
#include<string>
#include<map>
using namespace std;
int main()
{
    int n = 0;;
    float day = 0.0;
	string month;
	int dwMonth = 0;
	int year = 0;
	int totalDay = 0;
	cin >> n;
	cout << n;
	string strHaab[] = {"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu", "uayet"};
    map<string,int> mapHaab;
	for(int i = 0;i < 19;i++)
	{
		mapHaab.insert(map<string, int>::value_type(strHaab[i],i));
	}
	string strTzolkin[] = {"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"};
	while(n--)
	{
		cin >> day >> month >> year;
		map<string,int>::iterator ite = mapHaab.find(month);
		if(ite != mapHaab.end())
		{
			dwMonth = mapHaab[month];
		}
		totalDay = (int)day + 1 + 20 * dwMonth + year * 365;
		year = totalDay / 260;
		if(totalDay % 260 == 0)
		{
			year = year - 1;
			day = 13;
			month = "ahau";
		}
		else
		{
			day = (totalDay % 260) % 13;
			dwMonth = (totalDay % 260) % 20;
			month = strTzolkin[dwMonth-1];
		}
		cout << day << " " << 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