1008p

来源:互联网 发布:怎么看java源码 编辑:程序博客网 时间:2024/05/02 02:07

直接模拟

Code:
  1. //============================================================================   
  2. // Name        : 1008.cpp   
  3. // Author      : kevin   
  4. // Version     :   
  5. // Copyright   : copyright @ kevin   
  6. // Description : Hello World in C++, Ansi-style   
  7. //============================================================================   
  8.   
  9. #include <iostream>   
  10. #include<string>   
  11. using namespace std;   
  12.   
  13. int main()   
  14. {   
  15.     int n;   
  16.     bool flag=true;   
  17.     string haab[19]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};   
  18.     string tzlo[20]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};   
  19.     int num[13]={1,8,2,9,3,10,4,11,5,12,6,13,7};   
  20.     cin>>n;   
  21.     int temp=n;   
  22.     while(temp--)   
  23.     {   
  24.         int day,year,total,i,current;   
  25.         string s0,month;   
  26.         cin>>day>>s0>>month>>year;   
  27.         for(i=0;i<20;++i)   
  28.             if(month.compare(haab[i])==0)   
  29.                 break;   
  30.         total=day+i*20+year*365;   
  31.   
  32.         int number,year1;   
  33.         string name;   
  34.         year1=total/260;   
  35.         number=total%260;   
  36.         name=tzlo[number%20];   
  37.         if(flag)   
  38.         {   
  39.             cout<<n<<endl;   
  40.             flag=false;   
  41.         }   
  42.         current=number/20;   
  43.         i=num[current];   
  44.         for(int j=0;j<(number%20);++j)   
  45.         {   
  46.             if(i%13==0)   
  47.                 i=1;   
  48.             else  
  49.                 ++i;   
  50.         }   
  51.         cout<<i<<" "<<name<<" "<<year1<<endl;   
  52.     }   
  53.     return 0;   
  54. }   
  55.   

 

原创粉丝点击