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 trhy1990 at 2012-04-14 12:53:53 on Problem 1008
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstring>
using namespace std;

int main()
{
	ifstream cin("input.txt");
	
	char HaabMonthName[19][10] = {"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu", "uayet"};
	
	char TzolkinDayName[20][12] = {"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"};
	int n;	
	cin >> n;
	cout << n << endl;
	int i;
	int HaabDay;
	char dot;
	char HaabMonth[7];
	int HaabYear;
	int allDay;
	int TzolkinYear;
	int TzolkinMonth;
	int TzolkinDay;
	while (n > 0)
	{
		cin >> HaabDay >> dot >> HaabMonth >> HaabYear;
		
		for(i = 0; i < 19; i ++)
		{
			if(strcmp(HaabMonth, HaabMonthName[i]) == 0)
			{
				break;
			}
		} 
		allDay = HaabYear * 365 + 20 * i + HaabDay;
		
		//cout << allDay << endl;
		
		TzolkinYear = (allDay - 1) / 260;
		i = allDay % 260;
		TzolkinMonth = i % 13;
		TzolkinMonth ++;
		TzolkinDay = i % 20;
		
		cout << TzolkinMonth << " " << TzolkinDayName[TzolkinDay] << " " << TzolkinYear;
		//cout << TzolkinMonth << " " << TzolkinDay << " " << TzolkinYear;
		cout << endl;
		n --;
	}
	
	system("PAUSE");
	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