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

请教!老是woring answer!是什么问题啊。

Posted by plumage at 2005-04-17 21:33:20 on Problem 1008
#include<iostream.h>
#include<string.h>
#include<fstream.h>

#define lofhaab 365
#define loftzol 260
char Tzolkin[21][10]={"","imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
char Haab[20][10]={"","pop", "no", "zip", "zotz","tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu"};
void main()
{
  	fstream fin("in.txt",ios::in||ios::out);
	int n;

	fin>>n;	
	cout<<n<<endl;
	unsigned long day,year,days,name;
	char month[10];
	char point;
	int i,j;
	for(i=0;i<n;i++)
	{
		fin>>day>>point>>month>>year;
		for(j=1;j<20;j++)
		{
			if(strcmp(month,Haab[j])==0)
				break;
		}
		
		days=year*lofhaab+(day+1)+((j-1)*20);
	
		year=days/loftzol;//years in tozolkin
		days=days%loftzol;

		if(days==0)
		{
			days=loftzol;
			year--;
		}
		name=days%20; 
		day=days%13;

		if(day==0)
		{
			day=13;
		}
		if(name==0)
		{
			name=20;
		}

		cout<<day<<" "<<Tzolkin[name]<<" "<<year<<endl;
	}	
}

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