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. alternatives命令使用方法

    alternatives命令使用方法 alternatives是Linux下的一个功能强大的命令.仅仅能在root权限下运行.如系统中有几个命令功能十分相似,却又不能任意删除,那么能够用 altern ...

  2. iOS开发——UI篇&下拉弹出列表选择项效果

    下拉弹出列表选择项效果 右边菜单中的按键,点击弹出一个列表可选择,选择其中一个,响应相应的事件并把文字显示在右边的菜单上:弹出下拉效果使用LMDropdownView插件,可以用POD进行加载pod  ...

  3. xampp

    Fatal error: Class 'kernel' not found in C:\xampp\htdocs\shopex\install\install.core.php on line 10 ...

  4. C#多线程学习(一) 多线程的相关概念

    什么是进程?当一个程序开始运行时,它就是一个进程,进程包括运行中的程序和程序所使用到的内存和系统资源.而一个进程又是由多个线程所组成的. 什么是线程?线程是程序中的一个执行流,每个线程都有自己的专有寄 ...

  5. 如何用jquery操作table的方法

    今天我在做你约我吧交友www.niyuewo.com网项目时遇到一个问题,就是如何用qjuery控制table的添加.编辑与删除,经过网上查资料发现用jquery很容易实现,在此整理下来供大家参考: ...

  6. QFtp类参考

    QFtp是一个用来实现FTP协议的类. 详情请见…… #include <qftp.h> 继承了QNetworkProtocol. 所有成员函数的列表. 公有成员 QFtp () virt ...

  7. Android(java)学习笔记100:android开发中修改字体

    首先如果android内部自带的字体不是我们需要的字体,那我们就需要字体文件导入到android开发工程中,下午我们详细讲述: 1.我们首先分析知道,我想要TextView控件中文字的字体是:华文楷体 ...

  8. Inaccurate values for “Currently allocated space” and “Available free space” in the Shrink File dialog for TEMPDB only

    转载自:http://blogs.msdn.com/b/ialonso/archive/2012/10/08/inaccurate-values-for-currently-allocated-spa ...

  9. [改善Java代码]在接口中不要存在实现代码

    第3章  类.对象及方法 书读得多而不思考,你会觉得自己知道的很多. 书读得多而思考,你会觉得自己不懂的越来越多. —伏尔泰 在面向对象编程(Object-Oriented Programming,O ...

  10. listagg( ) within group ( order by ) 与 wm_concat

    listagg( ) within group ( order by ) 与 wm_concat --oracle 11g 及以后适合 最好 select spbywslid,listagg(xm,' ...