标签:
Description
Input
Output
Sample Input
3 10. zac 0 0. pop 0 10. zac 1995
Sample Output
3 3 chuen 0 1 imix 0 9 cimi 2801
输入换算的日期 计算出从0年开始到前一天的总天数t
t/260即为 第几年
再用总天数取余20 刚好计算出第t+1天的日期
用总天数取余13 需要再加1 因为是计算t+1天的日期!!!!
#include<iostream> #include<string> using namespace std; string s1[]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"}; string s2[]=
{"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"}; int f(string str,int a,int b) { int i; for(i=0;i<19;i++){ if(s1[i]==str)break; } return b*365+i*20+a; } void g(int n) { int a,b,x,y; a=n/260; x=n%13+1; y=n%20; cout<<x<<" "<<s2[y]<<" "<<a<<endl; } int main() { int n; cin>>n; cout<<n<<endl; while(n--){ int a,b,t; char d; string str; cin>>a>>d>>str>>b; t=f(str,a,b); g(t); } //system("pause"); return 0; }
标签:
原文地址:http://www.cnblogs.com/farewell-farewell/p/5193231.html