Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

帮忙看看

Posted by sdjzu_zyx at 2010-08-04 18:12:37 on Problem 1008
#include<iostream>
#include<string>
using namespace std;

int main()
{
    int sum,d,c,n,y,t;
    string m,M[21]={"eof","imix", "ik"," akbal", "kan"," chicchan", "cimi"," manik", "lamat"," muluk", "ok", "chuen", "eb", "ben", "ix", "mem"," cib"," caban", "eznab"," canac"," ahau "};
    cin>>n;
    char cha;//注意 字符与字符串定义不同, 股对应输入不同。
    cout<<n<<endl;
    for(int i=1;i<=n;i++)
    {
        cin>>d>>cha>>m>>y;
        if(m=="pop")
           c=0;
        if(m=="no")
           c=20;
        if(m=="zip")
           c=40;
        if(m=="zotz")
           c=60;
        if(m=="tzec")
           c=80;
        if(m=="xul")
           c=100;
        if(m=="yoxkin")
           c=120;
        if(m=="mol")
           c=140;
        if(m=="chen")
           c=160;
        if(m=="yax")
           c=180;
        if(m=="zac")
           c=200;
        if(m=="ceh")
           c=220;
        if(m=="mac")
           c=240;
        if(m=="kankin")
           c=260;
        if(m=="muan")
           c=280;
        if(m=="pax")
           c=300;
        if(m=="koyab")
           c=320;
        if(m=="cumhu")
           c=340;
        if(m=="uayet")
           c=360;
       sum=y*365+c+1+d;
       if(sum%260==0)
         {
             y=sum/260-1;
             d=20;
             t=13;
         }
       else
        {

          y=sum/260;
          if(sum%20==0)
             d=20;
          else
            d=sum%260%20;
          if(sum%13==0)
             t=13;
          else
             t=sum%260%13;
        }

       cout<<t<<" "<<M[d]<<" "<<y<<endl;

    }
    return 0;
}





Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator