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

哪位大神告诉我哪错了。。测试数据都没问题啊,那个4.uyat 259的也没问题啊啥情况

Posted by Saleed at 2016-04-15 15:20:10 on Problem 1008
#include<iostream>
#include<string>

//注意使用string时候也要定义std 

/*
> 4. uayet 259
> 正解是 13 ahau 364
> 而不是13 ahau 365
> 看看你的程序是不是 少了点情况没考虑 
*/
using namespace std;

int main(){
	long i,num,*haab_year,*haab_day,*tzol_year,*tzol_no;
	string *haab_month,*tzol_day;
	
	string haabM[19]={"pop"," no"," zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab","cumhu","uayet"};
	string tzolD[20]={"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"};
	cin>>num;
	haab_year=new long[num];
	haab_day=new long[num];
	tzol_year=new long[num];
	tzol_no=new long[num];
	haab_month=new string[num];
	tzol_day=new string[num];
	
	i=0;
	char dot;
	while(i<num){
		cin>>haab_day[i]>>dot>>haab_month[i]>>haab_year[i];
		i++;	
	} 
	cout<<num<<endl;
	for(int i=0;i<num;i++){
		for(int j=0;j<19;j++){
			if(haab_month[i]==haabM[j]){
				tzol_year[i]=((haab_year[i])*365+j*20+haab_day[i])/260;
				tzol_day[i]=tzolD[(((haab_year[i])*365+j*20+haab_day[i])%260)%20];
				tzol_no[i]=(((haab_year[i])*365+j*20+haab_day[i])%260)%13+1;///haab_day是0~19!而tzol_no是从1~13这里应该是1~13 
			}
		}
		cout<<tzol_no[i]<<" "<<tzol_day[i]<<" "<<tzol_year[i]<<endl;
	}
	return 1;
	}

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