实训三#3.10Maya历法

[problem description]
During his academic vacation, Professor M.A. Ya made an amazing discovery on the ancient Maya calendar. From an old and tricky message, the professor found that Maya civilization takes 365 days as a year, called Haab, and contains 19 months. The first 18 months have 20 days each month. The names of the months are pop, no, zip, zotz, tzec, XUL, yoxkin, mol, Chen, Yax, Zac, CEH, MAC, kankin, Muan, Pax, koyab and cumhu. The number of days per month is expressed in numbers, from 0 to 19, not by name. The last month of Haab is called uayet, which has five days, expressed as 0, 1, 2, 3 and 4. The Mayans thought this month was unlucky, the courts were closed, trade stopped, and people even stopped cleaning the floor.
        For religious purposes, Maya people use another calendar called Tzolkin (Winter Youth). A year is divided into 13 periods of 20 days each. Each day is represented by a number pair represented by a number and a date name. Use 20 names: iMix, IK, akbal, Kan, chicchan, CIMI, Manik, lamat, muluk, OK, Chuen, EB, Ben, IX, MEM, CIB, Caban, eznab, Canac, AHAU, and 13 numbers for double recycling.
        Please note that every day has a clear description. For example, the day at the beginning of the year is described as follows:
        1 iMix, 2 IK, 3 akbal, 4 Kan, 5 chicchan, 6 CIMI, 7 Manik, 8 lamat, 9 muluk, 10 OK, 11 Chuen, 12 EB, 13 Ben, 1 IX, 2 MEM, 3 CIB, 4 Caban, 5 eznab, 6 Canac, 7 AHAU, 8 iMix, 9 IK, 10 akbal
        The year (including Haab and Tzolkin) is represented by the numbers 0, 1,..., and the number 0 is the beginning of the world. Therefore, the first day is expressed as:
        Haab: 0. pop 0
       Tzolkin: 1 imix 0
       Please help Professor m.a.ya write a program to convert Haab calendar into Tzolkin calendar.   
[input form]
        In Haab, the date is expressed in the following form:
                NumberOfTheDay. Month Year
        The first line of the input file contains the number of input dates in the file. The next N lines contain n dates in Haab calendar format, and the year is less than 5000.
[output form]
         Tzolkin dates are in the following format:
                Number NameOfTheDay Year
         The output includes N lines. The date in Tzolkin calendar format is output in the order corresponding to the input date.  
[sample input]

3
10.zac 0
0.pop 0
10.zac 1995

【样例输出】

3 chuen 0
1 imix 0
9 cimi 2801

【样例说明】
【评分标准】

#include<iostream>
#include<string>
using namespace std;
void turn(int x,string a,int y){//转换函数
	int z=0,days,month,year,date;
	string c;
	if(a=="pop")z=1;
	else if(a=="no")z=2;
	else if(a=="zip")z=3;	
	else if(a=="zotz")z=4;
	else if(a=="tzec")z=5;
	else if(a=="xul")z=6;
	else if(a=="yoxkin")z=7;
	else if(a=="mol")z=8;	
	else if(a=="chen")z=9;
	else if(a=="yax")z=10;
	else if(a=="zac")z=11;
	else if(a=="ceh")z=12;
	else if(a=="macc")z=13;
	else if(a=="kankin")z=14;
	else if(a=="muan")z=15;
	else if(a=="pax")z=16;
	else if(a=="koyab")z=17;
	else if(a=="cumhu")z=18;
	else if(a=="uayet")z=19;
	days=x+1+(z-1)*20+y*365;//算出是世界开始的第几天
	date=days%13;
	if(date==0) date+=13; 
	month=days%20;
	year=days/260;//260天为1年
	switch(month){//将月份期间转化为字符串
		case 1:c="imix";break;
		case 2:c="ik";break;
		case 3:c="akbal";break;
		case 4:c="kan";break;
		case 5:c="chicchan";break;
		case 6:c="cimi";break;	
		case 7:c="manik";break;
		case 8:c="lamat";break;
		case 9:c="muluk";break;	
		case 10:c="ok";break;
		case 11:c="chuen";break;
		case 12:c="eb";break;
		case 13:c="ben";break;
		case 14:c="ix";break; 	
		case 15:c="mem";break;
		case 16:c="cib";break;
		case 17:c="caban";break;
		case 18:c="eznab";break;
		case 19:c="canac";break;
		case 0:c="ahau";break;		
	} 
	cout<<date<<' '<<c<<' '<<year<<endl;
}
int main(){
	int n;
	cin>>n;
	int num[n][2];
	string mon[n];
	char point;
	for(int i=0;i<n;i++)cin>>num[i][0]>>point>>mon[i]>>num[i][1];
	for(int i=0;i<n;i++)turn(num[i][0],mon[i],num[i][1]);
	return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
资源包主要包含以下内容: ASP项目源码:每个资源包中都包含完整的ASP项目源码,这些源码采用了经典的ASP技术开发,结构清晰、注释详细,帮助用户轻松理解整个项目的逻辑和实现方式。通过这些源码,用户可以学习到ASP的基本语法、服务器端脚本编写方法、数据库操作、用户权限管理等关键技术。 数据库设计文件:为了方便用户更好地理解系统的后台逻辑,每个项目中都附带了完整的数据库设计文件。这些文件通常包括数据库结构图、数据表设计文档,以及示例数据SQL脚本。用户可以通过这些文件快速搭建项目所需的数据库环境,并了解各个数据表之间的关系和作用。 详细的开发文档:每个资源包都附有详细的开发文档,文档内容包括项目背景介绍、功能模块说明、系统流程图、用户界面设计以及关键代码解析等。这些文档为用户提供了深入的学习材料,使得即便是从零开始的开发者也能逐步掌握项目开发的全过程。 项目演示与使用指南:为帮助用户更好地理解和使用这些ASP项目,每个资源包中都包含项目的演示文件和使用指南。演示文件通常以视频或图文形式展示项目的主要功能和操作流程,使用指南则详细说明了如何配置开发环境、部署项目以及常见问题的解决方法。 毕业设计参考:对于正在准备毕业设计的学生来说,这些资源包是绝佳的参考材料。每个项目不仅功能完善、结构清晰,还符合常见的毕业设计要求和标准。通过这些项目,学生可以学习到如何从零开始构建一个完整的Web系统,并积累丰富的项目经验。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值