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

Re:实在想不通为什么是wrong answer 那里错了?

Posted by 123345 at 2004-01-10 14:55:17 on Problem 1008
In Reply To:Re:实在想不通为什么是wrong answer Posted by:123345 at 2004-01-10 14:54:34
#include<iostream>
#include<string>

struct cal
{
	int d;
	int m1;
	std::string m2;
	int y;
};

void main()
{ 
	int n;
	std::cin>>n;
	std::string ha[19]={"pop","no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", 
		"yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu"};
	std::string tz[20]={"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", 
		"ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"};
	
	cal * c;
	char dot;
	c=new cal[n];
	for(int i=0;i<n;i++)
	{
		std::cin>>c[i].d>>dot>>c[i].m2>>c[i].y;
	}
	std::cout<<n<<std::endl;
	int total;
	int td,tm,ty;
	std::string tsm;
	for(int k=0;k<n;k++)
	{

	   for(int j=0;j<19;j++)
	   {
		   if(c[k].m2 ==ha[j]) 
		   {
			   c[k].m1=j;
			   break;
		   }
	   }
		   total=c[k].d +1+c[k].m1*20+c[k].y *365;
		 
		   if(total%260==0)
			   ty=total/260-1;
		   else
			   ty=total/260;
		   if(total%13==0)
			   td=13;
		   else
			   td=total%13;
		   if(total%20==0)
			   tm=20;
		   else
			   tm=total%20;
	   
		   for(int l=0;l<20;l++)
		   {
			   if(l==tm-1)
			   {
				   tsm=tz[l];
				   break;
			   }
		   }
		   std::cout<<td<<" "<<tsm<<" "<<ty<<std::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