poj 1008 Maya Calendar

poj 1008 Maya Calendar,第1张

poj 1008 Maya Calendar
#include<iostream>#include<string.h>using namespace std;string haab[] = { "pop", "no", "zip", "zotz", "tzec",   "xul", "yoxkin", "mol", "chen", "yax",   "zac", "ceh", "mac", "kankin", "muan",   "pax", "koyab", "cumhu", "uayet" };string tzolkin[] = { "imix", "ik", "akbal", "kan", "chicchan",  "cimi", "manik", "lamat", "muluk", "ok",  "chuen", "eb", "ben", "ix", "mem",  "cib", "caban", "eznab", "canac", "ahau" };int main(){int n;cin >> n;cout << n << endl;int year, month, day, days;int tyear, tmonth, tday;string smonth, temp;int i, j, k;while ( n > 0 ){cin>> day >> temp >> smonth >> year;days = 0;for( i = 0; ; i++ ){if( smonth == haab[ i ] )break;}month = i; days = year * 365 + month * 20 + day;tyear = days / 260;days  %= 260;tmonth = days % 20;tday = days % 13 + 1;cout<< tday << " " << tzolkin[ tmonth ] << " " << tyear <<endl;n--; }return 0;}

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/4912309.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-12
下一篇 2022-11-12

发表评论

登录后才能评论

评论列表(0条)

保存