首页 > 代码库 > POJ 1008 Maya Calendar
POJ 1008 Maya Calendar
Maya Calendar
思路:日历转换,仔细一点。
代码:
#include<iostream> #include<cstdio> #include<algorithm> #include<string> #include<map> using namespace std; #define ll long long #define pb push_back map<string,int>mp; string a[19]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"}; string b[20]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"}; int main() { int n; for(int i=0;i<19;i++)mp[a[i]]=i; cin>>n; cout<<n<<endl; while(n--) { int day,year; char doc; string month; cin>>day>>doc>>month>>year; //cout<<month<<endl; int t=year*365+mp[month]*20+day; int year1=t/260; string day1=b[t%20]; int day2=t%13+1; cout<<day2<<‘ ‘<<day1<<‘ ‘<<year1<<endl; } return 0; }
POJ 1008 Maya Calendar
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。