# 文章标题 poj 1008:玛雅历（模拟）

118人阅读 评论(0)

## 玛雅历

Description

Haab历和Tzolkin历中的年都用数字0，1，……表示，数字0表示世界的开始。所以第一天被表示成：
Haab: 0. pop 0
Tzolkin: 1 imix 0

Input

Haab历中的数据由如下的方式表示：

Output

Tzolkin历中的数据由如下的方式表示：

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
Translator

#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<math.h>
#include<queue>
#include<algorithm>
using namespace std;
const int inf = 0x3f3f3f3f;
//将haab的月份放进数组
char a[25][10]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol",
"chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};
//将Holly的日期放进数组
char b[25][10]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat",
"muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
int main ()
{
int total;
scanf ("%d",&total);
int q=total;
long long sum;
while (total--){
sum=0;
int day;
char t[30];
int year;
scanf ("%d. %s %d",&day,t,&year);
sum+=day+1;
for (int i=0;i<20;i++){
if (strcmp(a[i],t)==0){
sum+=i*20;
break;
}
}
int d,m,y;
sum+=year*365;
long long temp=sum;
y=temp/260;
if (temp%260==0) y--;//当除尽时减一
m=(temp)%13;
if (m==0)m=13;
d=temp%20;
if (d==0) d=20;
if (total==q-1)printf ("%d\n",q);
printf ("%d %s %d\n",m,b[d-1],y);// d-1是由于下标从0开始
}
return 0;
}
0
0

* 以上用户言论只代表其个人观点，不代表CSDN网站的观点或立场
个人资料
• 访问：13276次
• 积分：1772
• 等级：
• 排名：千里之外
• 原创：172篇
• 转载：6篇
• 译文：1篇
• 评论：3条
友情链接
最新评论