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 代码:
#include<stdio.h>
#include<string.h>
int main ()
{
char Haab[19][7] = {"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};
char Tzolkin[20][9] = {"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
int n,day,year,days,i;
char month[10]; scanf("%d", &n);
printf("%d\n", n); while(n--)
{
scanf("%d. %s %d",&day,month,&year); for(i = 0;i < 19;i++)
if(!strcmp(month,Haab[i]))
break; days = year*365 + i*20 + day; printf("%d %s %d\n",days%13 + 1,Tzolkin[days%20],days/260);
}
return 0;
}

  表示第二个没看懂,写的第三个。写完之后学到了数组的比较,之前写的是指针与数组比较,然后报错了。问了下度娘,他说用两个数组去比较,然后还学到了strcmp函数,还行吧。看了下第四题,没头绪,然后自己玩去了,嘿嘿,我也不是故意的。明天再肝吧,向大佬看齐!!!

数组C - 玛雅日历的更多相关文章

  1. poj 1008:Maya Calendar(模拟题,玛雅日历转换)

    Maya Calendar Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 64795   Accepted: 19978 D ...

  2. 使用MVVM框架avalon.js实现一个简易日历

    最近在做公司内部的运营管理系统,因为与日历密切相关,同时无需触发条件直接显示在页面上,所以针对这样的功能场景,我就用avalon快速实现了一个简易日历,毕竟也是第一次造日历这种轮子,所以这里记录下我当 ...

  3. avalon.js实现一个简易日历

    使用MVVM框架avalon.js实现一个简易日历   最近在做公司内部的运营管理系统,因为与日历密切相关,同时无需触发条件直接显示在页面上,所以针对这样的功能场景,我就用avalon快速实现了一个简 ...

  4. 日历时间选择控件---3(支持ie、火狐)

    效果展示:  源代码: <script language=javascript ><!--/* 调用方法:不能用onfocus,要用onclick  <input onclic ...

  5. 给开发者准备的 10 款最好的 jQuery 日历插件[转]

    这篇文章介绍的是 10 款最棒而且又很有用的 jQuery 日历插件,允许开发者们把这些漂亮的日历插件结合到自己的网站中.这些日历插件易用性都很强,轻轻松松的就可以把漂亮的日历插件装饰到你的网站了.希 ...

  6. 微信小程序横版日历,tab栏

    代码地址如下:http://www.demodashi.com/demo/14243.html 一.前期准备工作 软件环境:微信开发者工具 官方下载地址:https://mp.weixin.qq.co ...

  7. 用c写的简单的日历(学习模块划分)

    简单日历 ​ 主要目的是学习函数模块划分,成品大概是这样,加了一些花里胡哨的东西(/▽\) ​ 分三个模块,主函数.c 显示.c 计算.c 与.h 文件 有两种实现方式,区别在于是否以数组在模块之间传 ...

  8. Java 查漏补缺

    摘自<老马说编程> 计算机程序的思维逻辑 (4) - 整数的二进制表示与位运算 Java中不支持直接写二进制常量,比如,想写二进制形式的11001,Java中不能直接写,可以在前面补0,补 ...

  9. js实现时间控件

    <html><head> <title>时间控件</title></head><body > <input name=&q ...

随机推荐

  1. DNS缓存服务器的配置步骤

    yum安装bind 编辑主配置文件/etc/named.conf 修改全局配置文件段        listen-on  port 53 {172.16.19.45;}; //allow-query ...

  2. 关于“问吧APP”问卷调查报告分析与体会

         上周根据我们走廊奔跑队的“问吧APP”项目对本校范围内的学生发放了上百份调查问卷,并对此作出了统计和整理.针对我们项目所提出的问题涉及到的用户信息有性别.年龄.学历.职业.平时上网途径以及对 ...

  3. 三层神经网络自编码算法推导和MATLAB实现 (转载)

    转载自:http://www.cnblogs.com/tornadomeet/archive/2013/03/20/2970724.html 前言: 现在来进入sparse autoencoder的一 ...

  4. PHP 多文件打包下载 zip

    <?php $zipname = './photo.zip'; //服务器根目录下有文件夹public,其中包含三个文件img1.jpg, img2.jpg, img3.jpg,将这三个文件打包 ...

  5. laravel 字段映射问题,表单中提交字段与数据表中字段不一致

    在遇到提交表单时,表单中的name属性与数据表中的字段不一致,报错, 解决方法: 参考1:提交表单的时候,表单的name属性和数据表字段名称是一样的,这样有什么不妥么? 你数据库的信息给前端透露得越多 ...

  6. SQL Server 怎样生成序列号(虚拟数字辅助表)

    </pre><pre name="code" class="sql">--生成一个"序列" 或者说生成一个" ...

  7. 更新 pip & setuptools

    python -m pip install -U pip setuptools

  8. mysql(六)索引的数据结构

    先做抽象定义如下: 定义一条数据记录为一个二元组[key, data],key为记录的键值,对于不同的数据记录,key是互不相同的:data为数据记录除key外的数据. B-tree的特点: d为大于 ...

  9. 第88天:HTML5中使用classList操作css类

    在HTML5 API里,页面DOM里的每个节点上都有一个classList对象,程序员可以使用里面的方法新增.删除.修改节点上的CSS类.使用classList,程序员还可以用它来判断某个节点是否被赋 ...

  10. JDBC连接Oracle

    数据库的操作是当前系统开发必不可少的开发部分之一,尤其是在现在的大数据时代,数据库尤为重要.但是你真的懂得Java与数据库是怎么连接的么? 先给大家一个数据库连接的简单实例: package com. ...