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 horsejia at 2005-11-16 10:51:53 on Problem 1008
#include <iostream>
#include <cstdio>
using namespace std;

int main()
{
	int n;
	int i, j;
	int day, month, year;
	int nth;
	char szMonth[16];
	int out;
	char *inName[] = {"pop", "no", "zip", "zotz", "tzec", "xul", 
					"yoxkin", "mol", "chen", "yax", "zac", "ceh", 
					"mac", "kankin", "muan", "pax", "koyab", "cumhu", "uayet"};
 	char *outName[] = {"imix", "ik", "akbal", "kan", "chicchan", 
						"cimi", "manik", "lamat", "muluk", "ok", 
						"chuen", "eb", "ben", "ix", "mem", 
						"cib", "caban", "eznab", "canac", "ahau"};

	cin >> n;
	for (i = 0; i < n; i++)
	{
		cin >> day;
		cin.get();
		cin >> szMonth >> year;
		for (j = 0; j < 19 ; j++)
			if  (strcmp(szMonth, inName[j]) == 0)
				break;
		nth = day + 20 * j + 365 * year;
		day = nth % 13 + 1;
		out = nth % 20;
		year = nth / 260;
		cout << day << " " << outName[out] << " " << year << 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