POJ1008:玛雅日历

news2025/7/14 3:26:51

一、Description

在这里插入图片描述

During his last sabbatical, professor M. A. Ya made a surprising discovery about the old Maya calendar. From an old knotted message, professor discovered that the Maya civilization used a 365 day long year, called Haab, which had 19 months. Each of the first 18 months was 20 days long, and the names of the months were pop, no, zip, zotz, tzec, xul, yoxkin, mol, chen, yax, zac, ceh, mac, kankin, muan, pax, koyab, cumhu. Instead of having names, the days of the months were denoted by numbers starting from 0 to 19. The last month of Haab was called uayet and had 5 days denoted by numbers 0, 1, 2, 3, 4. The Maya believed that this month was unlucky, the court of justice was not in session, the trade stopped, people did not even sweep the floor.

For religious purposes, the Maya used another calendar in which the year was called Tzolkin (holly year). The year was divided into thirteen periods, each 20 days long. Each day was denoted by a pair consisting of a number and the name of the day. They used 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; both in cycles.

Notice that each day has an unambiguous description. For example, at the beginning of the year the days were 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, and again in the next period 8 imix, 9 ik, 10 akbal . . .

Years (both Haab and Tzolkin) were denoted by numbers 0, 1, : : : , where the number 0 was the beginning of the world. Thus, the first day was:

Haab: 0. pop 0

Tzolkin: 1 imix 0
Help professor M. A. Ya and write a program for him to convert the dates from the Haab calendar to the Tzolkin calendar.

二、Input

The date in Haab is given in the following format:
NumberOfTheDay. Month Year

The first line of the input file contains the number of the input dates in the file. The next n lines contain n dates in the Haab calendar format, each in separate line. The year is smaller then 5000.

三、Output

The date in Tzolkin should be in the following format:
Number NameOfTheDay Year

The first line of the output file contains the number of the output dates. In the next n lines, there are dates in the Tzolkin calendar format, in the order corresponding to the input dates.

四、Sample Input

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

五、Sample Output

3
3 chuen 0
1 imix 0
9 cimi 2801

六、Source

解法1

#include <cstdio>
#include <iostream>
#include <string>
using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    string ha[] = { "pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu", "uayet" };
    string tz[] = { "imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau" };
    int t;  cin >> t;   char doc;
    cout << t << endl;
    while(t--)
    {
        int day, year;  string month;
        cin >> day >> doc >> month >> year;
        day ++;
        int sum_day = day + year * 365;
        for(int i = 0; i < 19; i++)
        {
            if(ha[i] == month)
            {
                sum_day += 20 * i;
                break;
            }
        }
        cout << sum_day % 13 << " " << tz[sum_day % 20] << " " << sum_day / 260 << endl;
    }
    return 0;
}
/*
    Haab历: 365天
        19个月, 用 19 个单词表示,开始的18月中有20天,用0 ~ 19表示 最后一个月只有5天,用 0 ~ 4 表示。
        月份:pop, no, zip, zotz, tzec, xul, yoxkin, mol, chen, yax, zac, ceh, mac, kankin, muan, pax, koyab, cumhu, uayet
        天数:0 ~ 19, 0 ~ 4
    Tzolkin历:260天
        13个月, 用 1 ~ 13 表示, 每个月有20天, 用 20个单词 循环表示
        月份: 1 ~ 13
        天数: imix, ik, akbal, kan, chicchan, cimi, manik, lamat, muluk, ok, chuen, eb, ben, ix, mem, cib, caban, eznab, canac, ahau
    
        10.zac 0 ==> 3 chuen 0
        10 * 20 + 11 == 211
*/

解法2

#include <cstdio>
#include <iostream>
#include <string>
using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    string ha[] = { "pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu", "uayet" };
    string tz[] = { "imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau" };
    int t;  cin >> t;   char doc;
    cout << t << endl;
    while(t--)
    {
        int day, year;  string month;
        cin >> day >> doc >> month >> year;
        day ++;
        int sum_day = day + year * 365;
        for(int i = 0; i < 19; i++)
        {
            if(ha[i] == month)
            {
                sum_day += 20 * i;
                break;
            }
        }
        cout << sum_day % 13 << " " << tz[sum_day % 20] << " " << sum_day / 260 << endl;
    }
    return 0;
}
/*
    Haab历: 365天
        19个月, 用 19 个单词表示,开始的18月中有20天,用0 ~ 19表示 最后一个月只有5天,用 0 ~ 4 表示。
        月份:pop, no, zip, zotz, tzec, xul, yoxkin, mol, chen, yax, zac, ceh, mac, kankin, muan, pax, koyab, cumhu, uayet
        天数:0 ~ 19, 0 ~ 4
    Tzolkin历:260天
        13个月, 用 1 ~ 13 表示, 每个月有20天, 用 20个单词 循环表示
        月份: 1 ~ 13
        天数: imix, ik, akbal, kan, chicchan, cimi, manik, lamat, muluk, ok, chuen, eb, ben, ix, mem, cib, caban, eznab, canac, ahau
    
        10.zac 0 ==> 3 chuen 0
        10 * 20 + 11 == 211
*/

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/38303.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Netty学习笔记

文章目录二、Netty 入门2.1、概述2.1.1、Netty 是什么&#xff1f;2.1.2、Netty 的作者2.1.3、Netty 的地位2.1.4、Netty 的优势2.2、Hello World2.2.1、目标2.2.2、服务器端2.2.3、客户端2.2.4、流程梳理&#x1f4a1; 提示2.3、组件2.3.1、EventLoop&#x1f4a1; 优雅关闭演…

保姆级二进制安装高可用k8s集群文档(1.23.8)

保姆级二进制安装高可用k8s集群文档k8s搭建方式前期准备集群规划机器准备1、master vagrantfile2、master install.sh3、node vagrantfile4、node install.sh5、时间同步vagran 启动脚本vagrant up注意点安装conntrack 工具ipvs的安装VBoxManage snapshot 准备虚拟机快照ETCD部…

C语言编程作业参考答案

编程题参考答案 文章目录编程题参考答案week1_test选择结构-编程题循环结构上机练习数组编程函数编程2week1_test Write a program to output the average of 2 integers. #include <stdio.h>void main(){int a , b;double c;printf("Please enter 1 integers\n&q…

官网下载mysql 8.0.27及安装

https://www.mysql.com/downloads/&#xff0c;找到社区版下载链接MySQL Community (GPL) Downloads 1、 2、 3、 4、 5、

光谱异常样本检测分析

以近红外光谱为例&#xff0c;大部分光谱数据在不考虑分类问题时&#xff0c;在构建模型前需要对采集数据进行样本分析&#xff0c;以降低因生产过程异常、人为误操作和其他原因对软测量模型的影响&#xff0c;即异常样本检测分析。 按照定义&#xff0c;异常样本检测任务指的是…

k8s编程operator——(3) 自定义资源CRD.md

文章目录1、自定义资源的使用1.1 注册自定义资源1.2 使用自定义资源&#xff1a;1.3 Finalizers1.4 合法性验证2、如何操作自定义资源2.1 使用RestClient和DynamicClient来操作自定义资源对象2.2 使用sharedIndexInformer2.3 code-generator2.3.1 下载安装2.3.2 code-generator…

Ajax、Fetch、Axios三者的区别

1.Ajax&#xff08;Asynchronous JavaScript And XML&#xff09; Ajax 是一个技术统称&#xff0c;它很重要的特性之一就是让页面实现局部刷新。 特点&#xff1a; 局部刷新页面&#xff0c;无需重载整个页面。 简单来说&#xff0c;Ajax 是一种思想&#xff0c;XMLHttpReq…

毕业设计-基于机器学习的图片处理图片倾斜校正

前言 &#x1f4c5;大四是整个大学期间最忙碌的时光,一边要忙着备考或实习为毕业后面临的就业升学做准备,一边要为毕业设计耗费大量精力。近几年各个学校要求的毕设项目越来越难,有不少课题是研究生级别难度的,对本科同学来说是充满挑战。为帮助大家顺利通过和节省时间与精力投…

如何简单理解大数据

如何简单理解大数据 HDFS-存储 海量的数据存储 hadoop 只是一套工具的总称&#xff0c;它包含三部分&#xff1a;HDFS&#xff0c;Yarn&#xff0c;MapReduce&#xff0c;功能分别是分布式文件存储、资源调度和计算。 按理来说&#xff0c;这就足够了&#xff0c;就可以完成大…

matlab实现MCMC的马尔可夫转换MS- ARMA - GARCH模型估计

状态转换模型&#xff0c;尤其是马尔可夫转换&#xff08;MS&#xff09;模型&#xff0c;被认为是识别时间序列非线性的不错的方法。 估计非线性时间序列的方法是将MS模型与自回归移动平均 - 广义自回归条件异方差&#xff08;ARMA - GARCH&#xff09;模型相结合&#xff0c;…

Ubuntu22.04+Nvidia驱动+Cuda11.8+cudnn8.6

Ubuntu22.04Nvidia驱动Cuda11.8 一、准备环境 ubuntu 22.04nvidia显卡 这里使用的是RTX3060已安装Python3.10 二、安装pip3 # 安装 sudo apt install python3-pip # 升级 sudo pip3 install --upgrade pip # 如果要卸载&#xff0c;使用命令&#xff1a; sudo apt-get remov…

MySQL创建和管理表

基础知识 一条数据存储的过程 存储数据是处理数据的第一步 。只有正确地把数据存储起来&#xff0c;我们才能进行有效的处理和分析。否则&#xff0c;只能是一团乱麻&#xff0c;无从下手。 那么&#xff0c;怎样才能把用户各种经营相关的、纷繁复杂的数据&#xff0c;有序、…

ES6解析赋值

ES6中新增了一种数据处理方式&#xff0c;可以将数组和对象的值提取出来对变量进行赋值&#xff0c;这个过程时将一个数据结构分解成更小的部分&#xff0c;称之为解析。 1.对象解析赋值: 在ES5中&#xff0c;要将一个对象的属性提取出来&#xff0c;需要经过一下几个过程。 …

aws sdk 学习和使用aws-sdk-go

https://www.go-on-aws.com/infrastructure-as-go/cdk-go/sdk example&#xff0c;https://github.com/awsdocs/aws-doc-sdk-examples golang的安装&#xff0c;使用1.15之后默认开启GO15VENDOREXPERIMENT的版本 yum install golang -y go env -w GOPROXYhttps://goproxy.cn,…

智慧教室解决方案-最新全套文件

智慧教室解决方案-最新全套文件一、建设背景1、教育信息化2.0行动计划2、中国教育现代化20353、加快推进教育现代化实施方案二、建设思路互联网时代教学环境定义三、建设方案四、获取 - 智慧教室全套最新解决方案合集一、建设背景 1、教育信息化2.0行动计划 “网络学习空间覆…

【直播】-DRM和TZC400的介绍-2022/11/26

直播背景和内容 最近有两位SOC大佬再和我探讨TZC的设计&#xff0c;以及使用场景。也有几位软件工程师&#xff0c;在深入得学习安全技术&#xff0c;也问到了TZC相关的技术。 然后就搞了本次的直播&#xff0c;共计17人报名。 上线12位同学。(有ASIC大佬、有软件大佬、芯片严…

shell脚本的条件判断3:探究[[]]和[]的区别

前言 实例中除非特别标注&#xff0c;否则都不是在centos中测试的。 一 简述 多数情况下[]和[[]]是可以通用的&#xff0c;两者的主要差异是&#xff1a;test或[]是符合POSIX标准的测试语句&#xff0c;兼容性更强&#xff0c;几乎可以运行在所有Shell解释器中&#xff0c;相…

驱动保护进程 句柄降权 杀软自保 游戏破图标技术原理和实现

文章目录实现效果实现原理代码实现实现效果句柄降权对抗(实现破游戏图标和关闭杀软自保)降权对抗延伸游戏降权对抗杀软自保对抗隐藏Object钩子回调完整代码实现效果 效果如图所示&#xff1a; 无法结束进程&#xff1a; CE无图标&#xff1a; 内存无法读取 可以看到被保护的进…

STC 51单片机41——汇编 串口连续发送数据

; 仿真时&#xff0c;单步运行&#xff0c;记得设置虚拟串口数据 ORG 0000H MOV TMOD ,#20H ;定时器1&#xff0c;工作方式2&#xff0c;8位重装载 MOV TH1,#0FDH ; 波特率9600 MOV TL1,#0FDH SETB TR1 ; 启动T1 MOV SCON ,#40H ; 串口工作方式1 …

[激光原理与应用-20]:《激光原理与技术》-6- 谐振腔的结构、作用、工作原理

目录 第1章 谐振腔简介 1.1 什么是谐振腔 1.2 什么是光学谐振腔 1.3 谐振腔的作用 1.4 什么是镜片镀膜 第2章 谐振腔的结构与工作原理 2.1 谐振腔的结构 2.2 谐振腔的分类 2.3 激活介质与谐振腔的工作原理 第1章 谐振腔简介 1.1 什么是谐振腔 谐振腔&#xff0c;是…