# 加载中...

abentu
• 博客等级：
• 博客积分：0
• 博客访问：15,882
• 关注人气：4
• 获赠金笔：0支
• 赠出金笔：0支
• 荣誉徽章：

## poj1008-Maya Calendar

(2010-09-02 10:05:35)

### 杂谈

这道题是两个日历对应的题目，用孙子定理较为麻烦，可以直接用一个的日期枚举另一个~

水过~~

#include "stdio.h"
#include "string.h"
#include "memory.h"
const char h[20][10] = {"","pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu","uayet"};
const char t[21][10] = {"","imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau" };
int num1,year1,num2,year2,n,k,day;
char name1[10],name2[10],c;

int main()
{
freopen("3.txt","r",stdin);
freopen("4.txt","w",stdout);

scanf("%d",&n);
printf("%d\n",n);

while(n-- > 0)
{
scanf("%d%c%s%d",&num1,&c,name1,&year1);
for (k = 1;k <= 19;k ++)
{
if (strcmp(h[k],name1) == 0)
break;
}
day = 0;
day += (k-1) * 20;
day += num1;
day += year1 * 365;

year2 = day / 260;
day = day % 260 + 1;
num2 = (day - 1) % 13 + 1;
k = (day - 1) % 20 + 1;
strcpy(name2,t[k]);

printf("%d %s %d\n",num2,name2,year2);
}

return 0;
}

0

• 评论加载中，请稍候...

发评论

以上网友发言只代表其个人观点，不代表新浪网的观点或立场。

新浪BLOG意见反馈留言板　电话：4000520066 提示音后按1键（按当地市话标准计费）　欢迎批评指正

新浪公司 版权所有