简单模拟,现将第一种日历表示的天数计算出来,再转换为第二种日历。注意边写边检查

POJ - 1008Maya Calendar

Time Limit: 1000MS

Memory Limit: 10000KB

64bit IO Format: %I64d & %I64u

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

Central Europe 1995

 1 #include<stdio.h>
 2 #include<string.h>
 3
 4 char Haab[19][10] = {
 5     "pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax",
 6     "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu", "uayet"};
 7 char Tzolkin[20][10] = {
 8      "imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok",
 9      "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"};
10
11 int main(){
12     int cnt = 0, d = 0, y = 0, sum = 0, i = 0, m2 = 0, y2 = 0;
13     char m[10] = {0}, d2[10] = {0};
14     scanf("%d", &cnt);
15     printf("%d\n", cnt);
16     while(cnt--) {
17         sum = 0;
18         scanf("%d. %s %d", &d, m, &y);
19
20         sum += y * 365;
21         for(i = 0; i < 19; i++) {
22             if(!strcmp(m, Haab[i])) {
23                 break;
24             }
25         }
26         sum += i * 20;
27         sum += d;
28
29         y2 = sum / 260;
30         m2 = sum % 13 + 1;
31         strcpy(d2, Tzolkin[sum % 20]);
32
33         printf("%d %s %d\n", m2, d2, y2);
34
35     }
36     return 0;
37 }

转载于:https://www.cnblogs.com/acmicky/p/3220770.html

POJ - 1008 Maya Calendar相关推荐

  1. 百炼1008:Maya Calendar

    描述 During his last sabbatical, professor M. A. Ya made a surprising discovery about the old Maya cal ...

  2. 【POJ】1008 Maya Calendar

    参考:https://blog.csdn.net/u011392408/article/details/28866779 https://blog.csdn.net/qq_36424540/artic ...

  3. 1008:Maya Calendar

    题意:将Habb日历,天 月 年:表示成Tzolkin日历 数字 名称 年 Habb 第一年从0开始,一年 = 365天 = 19个月 每月对应字母,前18个月 = 20天,第一天从0开始 第19个月 ...

  4. POJ1008 Maya Calendar

    题目来源:http://poj.org/problem?id=1008 题目大意: Maya人认为一年有365天,但他们有两种日历.一种叫做Haab,有19个月.前18个月每月20天,每个月的名字分别 ...

  5. Maya Calendar

    学会用字符数组来存.还有读取数据的细节.两个年对应的关系. #include <iostream> #include <cstring> #include <cstdio ...

  6. POJ前面的题目算法思路【转】

    1000 A+B Problem 送分题 49% 2005-5-7 1001 Exponentiation 高精度 85% 2005-5-7 1002 487-3279 n/a 90% 2005-5- ...

  7. POJ 超详细分类

    POJ 各题算法 1000    A+B Problem            送分题     49%    2005-5-7 1001    Exponentiation         高精度   ...

  8. oracle导出数据一闪就没,Pl/Sql 导入dmp文件时窗口一闪而过

    C#操作剪贴板 操作剪贴版,主要用到了ClipBoard类. 该类位于 System.Windows(WPF)或System.Windows.Forms(Winform)下. 1.设置内容到剪贴版上: ...

  9. POJ 百炼 保研机试 2965:玛雅历

    2965:玛雅历 查看 提交 统计 提示 提问 总时间限制:  1000ms  内存限制:  65536kB 描述 上周末,M.A. Ya教授对古老的玛雅有了一个重大发现.从一个古老的节绳(玛雅人用于 ...

最新文章

  1. 深度学习不得不会的迁移学习Transfer Learning
  2. ABP的新旧版本选型
  3. CButton按钮添加图片 Bitmap Icon
  4. pytorch clamp 与clamp_区别
  5. 出错提示:“Could not flush the DNS Resolver Cache: 执行期间,函数出了问题”的解决方法...
  6. 进程与服务的签名_服务器被黑客攻击后如何查找溯源攻击
  7. 全网最详细的idea安装教程
  8. facebook轮播视频_如何设置Facebook Messenger Messenger视频通话
  9. SpringBoot的使用01
  10. 租房网开发时es使用8.x版本时相关知识点相对于视频教程用的es6.x的不同点(参考,可能不太完善)
  11. 微信自定义分享功能;分享朋友,分享到朋友圈
  12. 项目落地 - 智慧海绵城市(物联网技术应用)
  13. photoshop修改启动图教程
  14. SQL语句模糊查询 JavaWeb 项目 dao层 【常用来做搜索框】
  15. Web系统大规模并发——电商秒杀与抢购
  16. java冒泡排序经典代码(Java冒泡排序)
  17. Elasticsearch集群的脑裂问题
  18. svn: E170001报错的原因以及解决方案
  19. 测试工程师应该具备的软性能力有哪些?
  20. android仿微信语音聊天功能,Android仿微信发送语音消息的功能及示例代码

热门文章

  1. MongoDB的ObjectId生成原理
  2. layui的table常用方法
  3. MySQL GUI图形化界面常用软件推荐
  4. TOYOTA SYSTEMS Programming Contest 2021(AtCoder Beginner Contest 228) ABCD
  5. 【编辑器】VSCode+TEXLIVE环境配置,以SJTUthesis为测试用例
  6. 【编辑器】vscode修改背景图片的插件们
  7. python删除文件夹中的jpg_python删除文件夹下相同文件和无法打开的图片
  8. html禁用选择,html – 设置可选的禁用属性
  9. Python入门--列表的查询操作--获取列表知道那个元素的索引、获取列表中的单个元素、获取列表中的多个元素
  10. 多校 HDU 6313 Hack It——构造