锁定老帖子 主题:杰哥私房题──玛雅历
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2009-03-03
问题描述
#include <stdio.h> int main(){ int nCases; char* haab[] = {"pop","no","zip", "zotz", "tzec", "xul", "yoxkin","mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu", "uayet"}; char* tzolkin[] = {"imix","ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban","eznab", "canac", "ahau"}; scanf("%d", &nCases); printf("%d\n", nCases); while(nCases --){ int hYear, hDay; char hMonth[10]; int i = 0; scanf("%d.%s %d", &hDay, hMonth, &hYear); while(strcmp(hMonth, haab[i])){ i++; } int days; days = hYear * 365 + i * 20 + hDay; int zYear = days / 260; printf("%d.%s %d\n", days % 13 + 1, tzolkin[days % 20], zYear); } return 0; } 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2009-03-30
pku 1008标准水题一道
|
|
返回顶楼 | |
发表时间:2009-04-01
以前看过鸟哥私房菜。现在来个杰哥私房菜。我晕倒
|
|
返回顶楼 | |
浏览 2292 次