1.Link:

http://poj.org/problem?id=1008

http://bailian.openjudge.cn/practice/1008/

2.content:

Maya Calendar
Time Limit: 1000MS   Memory Limit: 10000K
Total Submissions: 66971   Accepted: 20644

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

3.Method:

简单题目,唯一要注意的是Haab历的日期是从0开始的,而tzolkin历是从1开始

4.Code:

 #include <iostream>
#include <string> using namespace std; const int haab_day_of_year = * + ;
const string name_of_month_haab[] = {"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu","uayet"};
const int haab_num_of_month = ;
const int haab_day_of_month = ; const int tzolkin_day_of_year = * ;
const int tzolkin_day_of_num = ;
const int tzolkin_day_of_period = ;
const string name_of_num[] = {"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben","ix", "mem", "cib", "caban", "eznab", "canac", "ahau"}; int get_haab_day(const int year,const string str_month,const int day)
{
int count = year * haab_day_of_year; int i = ;
for(i = ; i < haab_num_of_month; ++i) if(str_month == name_of_month_haab[i]) break;
count += i * haab_day_of_month + day; return count; } void get_tzolkin_date_of_count(const int count)
{
int year = count / tzolkin_day_of_year; int l_count = count % tzolkin_day_of_year; int num = l_count % tzolkin_day_of_num;
int period = l_count % tzolkin_day_of_period + ; cout << period << " " << name_of_num[num] << " " << year << endl; return; } int main()
{
//freopen("D://input.txt","r",stdin); int n;
cin >> n; cout << n << endl; while(n--)
{
int day = ;
string str_month = "";
int year = ; cin >> day;
cin.get();
cin >> str_month >> year; //cout << "year= " << year << endl;
//cout << "month= " << str_month << endl;
//cout << "day= " << day << endl; int count = get_haab_day(year,str_month,day); //cout << count << endl; get_tzolkin_date_of_count(count); } return ;
}

Poj OpenJudge 百练 Bailian 1008 Maya Calendar的更多相关文章

  1. Poj OpenJudge 百练 1062 昂贵的聘礼

    1.Link: http://poj.org/problem?id=1062 http://bailian.openjudge.cn/practice/1062/ 2.Content: 昂贵的聘礼 T ...

  2. Poj OpenJudge 百练 1860 Currency Exchang

    1.Link: http://poj.org/problem?id=1860 http://bailian.openjudge.cn/practice/1860 2.Content: Currency ...

  3. Poj OpenJudge 百练 2602 Superlong sums

    1.Link: http://poj.org/problem?id=2602 http://bailian.openjudge.cn/practice/2602/ 2.Content: Superlo ...

  4. Poj OpenJudge 百练 2389 Bull Math

    1.Link: http://poj.org/problem?id=2389 http://bailian.openjudge.cn/practice/2389/ 2.Content: Bull Ma ...

  5. Poj OpenJudge 百练 1573 Robot Motion

    1.Link: http://poj.org/problem?id=1573 http://bailian.openjudge.cn/practice/1573/ 2.Content: Robot M ...

  6. Poj OpenJudge 百练 2632 Crashing Robots

    1.Link: http://poj.org/problem?id=2632 http://bailian.openjudge.cn/practice/2632/ 2.Content: Crashin ...

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

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

  8. POJ 1008 Maya Calendar

    链接:http://poj.org/problem?id=1008 Maya Calendar Time Limit: 1000MS   Memory Limit: 10000K Total Subm ...

  9. [POJ 1008] Maya Calendar C++解题

        Maya Calendar Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 62297   Accepted: 192 ...

随机推荐

  1. 动态SQL使用小结

    1.什么是动态SQL? 静态 SQL:静态 SQL 语句一般用于嵌入式 SQL 应用中,在程序运行前,SQL 语句必须是确定的,例如 SQL 语句中涉及的列名和表名必须是存在的.静态 SQL 语句的编 ...

  2. iOS开发——动画篇Swift篇&动画效果的实现

    Swift - 动画效果的实现   在iOS中,实现动画有两种方法.一个是统一的animateWithDuration,另一个是组合出现的beginAnimations和commitAnimation ...

  3. CentOS5.6 安装RabbitMQ

    步骤参考官方地址:http://www.rabbitmq.com/install-rpm.html我们这个版本按照官方的不能正确安装. 1.安装erlang(官网地址http://www.erlang ...

  4. xmlns="http://schemas.xmlsoap.org/wsdl/",这是什么意思,我只知道:xmlns:xx=....,

    表示没有prefix,相当于你的xsi为空.这个很常用,后面就省得每行都要加一个前缀了. 解决方案 » "后面就省得每行都要加一个前缀了",意思是,后面的子元素如果没有名称空间前缀 ...

  5. CF Error Correct System

    Error Correct System time limit per test 2 seconds memory limit per test 256 megabytes input standar ...

  6. MySQL 更改默认编码为 utf8 (转)

      转自blog.sina.com.cn/s/blog_4c451e0e0100vefm.html 1.打开MySQL安装目录找到 my.ini,如:C:\Program Files\MySQL\My ...

  7. 关于Java多态的总结.

    [圣思源笔记]JAVA SE Lesson 11. 类是一种抽象的概念,对象是类的一种具体表示形式,是具体的概念.先有类,然后由类来生成对象(Object).对象又叫做实例(Instance).2. ...

  8. poj 2553 强连通分支与缩点

    思路:将所有强连通分支找出来,并进行缩点,然后找其中所有出度为0的连通分支,就是题目要求的. #include<iostream> #include<cstdio> #incl ...

  9. COGS 265 线段覆盖

    265. 线段覆盖 ★★☆   输入文件:xdfg.in   输出文件:xdfg.out   简单对比时间限制:2 s   内存限制:20 MB [问题描述] 有一根长度为 L 的白色条状物.有两种操 ...

  10. php-fpm配置文件详解

    第一部分:FPM 配置 参数 | 说明 -p | 命令行中动态修改--prefix ;include=etc/fpm.d/*.conf | 用于包含一个或多个文件,如果glob(3)存在(glob() ...