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:1008题玛亚日历的程序请高人指点错在那里,有报酬

Posted by kevin655 at 2006-04-07 14:17:02
In Reply To:1008题玛亚日历的程序请高人指点错在那里,有报酬 Posted by:alpc24 at 2006-04-07 14:06:53
> #include<iostream.h>
> #include<string.h>
> #include<stdio.h>
> main()
> {
> 	int num=0;
> 	char *haab[23]={"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu","uayet"};
> 	char  *T[23]={"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"};
> 	cin>>num;
> 	for(int i=0;i<num;i++)
> 	{
> 		int day=0;
> 		char b;
> 		int month=0;
> 		char arrey[10];
> 		int year=0;
> 		int sum=0;
> 		cin>>day>>b>>arrey>>year;
> 		for(int j=0;j<19;j++)
> 		{
> 			if(strcmp(haab[j],arrey)==0)
> 				month=j;
> 				
> 		}
> 		sum=year*365+month*20+day+1;
> 		//cout<<sum;
> 		int Tzolkin_day=0;
> 		int Tzolkin_month=0;
> 		int Tzolkin_year=0;
> 		
> 		    //Tzolkin_year=(Tzolkin_year+1)%260;
> 			
> 			Tzolkin_year=sum/260;
>                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~第260天与第259天还是在同一年,此处应为(sum-1)/260,^_^
> 			Tzolkin_month=sum%13;
> 			Tzolkin_day=sum%20;
> 
> 
> 
> 			
> 
> 
> 
> 		
> 		
> 		  //if(i==0)
> 			//cout<<num<<'\n';
> 		 if(Tzolkin_month==0)
> 			  Tzolkin_month=13;
> 		if(Tzolkin_day==0)
> 			Tzolkin_day=19;
> 		else
> 			Tzolkin_day=Tzolkin_day-1;
> 
> 
> 		cout<<Tzolkin_month<<" "<<T[Tzolkin_day]<<" "<<Tzolkin_year<<'\n';
> 		
> 
> 
> 	
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 	}
> 	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