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 ...
随机推荐
- UVA11361 Investigating Div-Sum Property(数位dp)
转载请注明出处: http://www.cnblogs.com/fraud/ ——by fraud 题目意思:问在区间[A,B]有多少个数不仅满足自身是k的倍数,而且其各个位数上的和 ...
- OFBiz应用https与http方式访问切换
url.properties port.https.enabled=N port.https=8444 force.https.host=
- 10--动作系统(四)动作类中的reverse方法
上一篇文章在使用持续动作过程中遇到不少问题,以获取动作类的反系动作尤为突出.所以今天把动作类找了个遍,先将大部分动作类是否实现reverse方法总结如下: T表示实现F表示没有实现. 观察可以发现带T ...
- [Head First Python]3. 文件与异常:处理错误
datafile.txt Man: Is this the right room for an argument? Other Man: I've told you once. Man: No you ...
- Python for else 循环控制
for语句可用来遍历某一对象,还具有一个可选的else块.如果for循环未被break终止,则执行else块中的语句.break 在需要时终止for循环continue 跳过位于其后的语句,开始下一轮 ...
- Hdu1001(1到100的和)
常规算法: #include <stdio.h> int main() { // 常规算法 int a; while(scanf("%d",&a)!=EOF){ ...
- 推荐大家一本学习php模式的书
对我来讲,写程序不是码代码,不想只是简单的将类拿来调用,然后功能实现了,可是以后要做一些扩展或者是修改就要对代码大刀阔斧. 在网站的开发过程中,使用一些框架,团队就可以在一定的程度上,分工合作.但是当 ...
- Android创建和使用数据库详细指南(1)
http://database.51cto.com/art/200903/113334.htm 数据库支持每个应用程序无论大小的生命线,除非你的应用程序只处理简单的数据,那么就需要一个数据库系统存储你 ...
- 开源C/C++网络库比较
在开源的C/C++网络库中, 常用的就那么几个, 在业界知名度最高的, 应该是ACE了, 不过是个重量级的大家伙, 轻量级的有libevent, libev, 还有 Boost的ASIO. ACE是一 ...
- Qt Project的持续集成方案
作者:齐亮链接:http://www.zhihu.com/question/24314354/answer/27547787来源:知乎著作权归作者所有,转载请联系作者获得授权. PETER HARTM ...