B - Maya Calendar(第二季水)
Description
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 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 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 输入换算的日期 计算出从0年开始到前一天的总天数t
t/260即为 第几年
再用总天数取余20 刚好计算出第t+1天的日期
用总天数取余13 需要再加1 因为是计算t+1天的日期!!!!
#include<iostream>
#include<string>
using namespace std;
string s1[]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};
string s2[]=
{"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
int f(string str,int a,int b)
{
int i;
for(i=;i<;i++){
if(s1[i]==str)break;
}
return b*+i*+a;
}
void g(int n)
{
int a,b,x,y;
a=n/;
x=n%+;
y=n%;
cout<<x<<" "<<s2[y]<<" "<<a<<endl;
}
int main()
{
int n;
cin>>n;
cout<<n<<endl;
while(n--){
int a,b,t;
char d;
string str;
cin>>a>>d>>str>>b;
t=f(str,a,b);
g(t);
}
//system("pause");
return ;
}
B - Maya Calendar(第二季水)的更多相关文章
- F - The Fun Number System(第二季水)
Description In a k bit 2's complement number, where the bits are indexed from 0 to k-1, the weight o ...
- D - Counterfeit Dollar(第二季水)
Description Sally Jones has a dozen Voyageur silver dollars. However, only eleven of the coins are t ...
- S - 骨牌铺方格(第二季水)
Description 在2×n的一个长方形方格中,用一个1× 2的骨牌铺满方格,输入n ,输出铺放方案的总数. 例如n=3时,为2× 3方格,骨牌的铺放方案有三种, ...
- R - 一只小蜜蜂...(第二季水)
Description 有一只经过训练的蜜蜂只能爬向右侧相邻的蜂房,不能反向爬行.请编程计算蜜蜂从蜂房a爬到蜂房b的可能路线数. 其中,蜂房的结构如下所示. ...
- I - Long Distance Racing(第二季水)
Description Bessie is training for her next race by running on a path that includes hills so that sh ...
- Y - Design T-Shirt(第二季水)
Description Soon after he decided to design a T-shirt for our Algorithm Board on Free-City BBS, XKA ...
- N - Robot Motion(第二季水)
Description A robot has been programmed to follow the instructions in its path. Instructions for the ...
- T - 阿牛的EOF牛肉串(第二季水)
Description 今年的ACM暑期集训队一共有18人,分为6支队伍.其中有一个叫做EOF的队伍,由04级的阿牛.XC以及05级的COY组成.在共同的集训生活中,大家建立了深厚的 ...
- E - Number Sequence(第二季水)
Description A single positive integer i is given. Write a program to find the digit located in the p ...
随机推荐
- PHP学习笔记二十一【全局变量】
<?PHP //定义全局变量 global $a; $a=9; //给全局变量赋值 function test1() { global $a; $a=45; } test1(); echo $a ...
- (转) Special members
原地址:http://www.cplusplus.com/doc/tutorial/classes2/ Special members [NOTE: This chapter requires p ...
- Niagara AX之axvelocity的使用
axvelocity是一个Web模板引擎模块,来源于Apache Velocity.由于我的Niagara AX的许可没有axvelocity,因此,在palette中没有找到axvelocity. ...
- (原)Ubuntu16 中安装torch版的cudnn
转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5668471.html 参考网址: https://devtalk.nvidia.com/default ...
- OS X EI Capitan 10.11.4中sudo无法起作用的解决方法
mac升级到OSX EI Capitan 10.11.4后sudo命令无法起作用,执行任何操作总是显示Operation denied.这是因为在10.11.4中引入了Rootless机制,即就算是R ...
- MYSQL操作的一些知识点,持续更新中····
基本概念——库 1.数据库服务器:库——>表——>行/列 2.cmd下链接: mysql – uroot –proot 3.创建库:create database php; 3.看数据库 ...
- Hibernate中HQL的日期差值计算,可计算相差多少秒
最近有个业务需求就是计算订单创建时间离现在超过 4 小时的订单都查找出来! 那么就需要用到日期函数了. 网上找了一下总共的日期函数有一下几个: CURRENT_DATE() 返回数据库当前日期 时间函 ...
- 重读LPTHW-Lesson1-14
1.python print 可以用"Hello World",也可以用'Hello World',或者”””Hello World ””” 2.要打印在一行,可以在改行后加英文逗 ...
- 发布(Windows)
发布(Windows) 本篇将在这个系列演示的例子上继续记录Asp.Net Core在Windows上发布的过程. Asp.Net Core在Windows上可以采用两种运行方式.一种是自托管运行,另 ...
- 像asp.net Mvc一样开发nodejs+express Mvc站点
像asp.net Mvc一样开发nodejs+express Mvc站点 首先,我是个c#码农.从事Mvc开发已然4个年头了,这两年前端MVC的兴起,我也跟风学了一些,对前端的框架也了解一些,angu ...