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 201501060326 at 2016-02-20 16:00:37 on Problem 1008
#include <stdio.h>
int fxs(char s[])
{
    int p;
    if(s[0]=='p'&&s[1]=='o'&&s[2]=='p')
        p=1;
    else if(s[0]=='n'&&s[1]=='o')
        p=2;
    else if(s[0]=='z'&&s[1]=='i'&&s[2]=='p')
        p=3;
    else if(s[0]=='z'&&s[1]=='o'&&s[2]=='t'&&s[3]=='z')
        p=4;
    else if(s[0]=='t'&&s[1]=='z'&&s[2]=='e'&&s[3]=='c')
        p=5;
    else if(s[0]=='x'&&s[1]=='u'&&s[2]=='l')
        p=6;
    else if(s[0]=='y'&&s[1]=='o'&&s[2]=='x'&&s[3]=='k'&&s[4]=='i'&&s[5]=='n')
        p=7;
    else if(s[0]=='m'&&s[1]=='o'&&s[2]=='l')
        p=8;
    else if(s[0]=='c'&&s[1]=='h'&&s[2]=='e'&&s[3]=='n')
        p=9;
    else if(s[0]=='y'&&s[1]=='a'&&s[2]=='x')
        p=10;
    else if(s[0]=='z'&&s[1]=='a'&&s[2]=='c')
        p=11;
    else if(s[0]=='c'&&s[1]=='e'&&s[2]=='h')
        p=12;
    else if(s[0]=='m'&&s[1]=='a'&&s[2]=='c')
        p=13;
    else if(s[0]=='k'&&s[1]=='a'&&s[2]=='n'&&s[3]=='k'&&s[4]=='i'&&s[5]=='n')
        p=14;
    else if(s[0]=='m'&&s[1]=='u'&&s[2]=='a'&&s[3]=='n')
        p=15;
    else if(s[0]=='p'&&s[1]=='a'&&s[2]=='x')
        p=16;
    else if(s[0]=='k'&&s[1]=='o'&&s[2]=='y'&&s[3]=='a'&&s[4]=='b')
        p=17;
    else if(s[0]=='c'&&s[1]=='u'&&s[2]=='m'&&s[3]=='h'&&s[4]=='u')
        p=18;
    else if(s[0]=='u'&&s[1]=='a'&&s[2]=='y'&&s[3]=='e'&&s[4]=='t')
        p=19;
    return p;
}
int fxv(int m)
{
    if(m==1)
        printf("imix");
    else if(m==2)
        printf("ik");
    else if(m==3)
        printf("akbal");
    else if(m==4)
        printf("kan");
    else if(m==5)
        printf("chicchan");
    else if(m==6)
        printf("cimi");
    else if(m==7)
        printf("manik");
    else if(m==8)
        printf("lamat");
    else if(m==9)
        printf("muluk");
    else if(m==10)
        printf("ok");
    else if(m==11)
        printf("chuen");
    else if(m==12)
        printf("eb");
    else if(m==13)
        printf("ben");
    else if(m==14)
        printf("ix");
    else if(m==15)
        printf("mem");
    else if(m==16)
        printf("cib");
    else if(m==17)
        printf("caban");
    else if(m==18)
        printf("eznab");
    else if(m==19)
        printf("canac");
    else if(m==20)
        printf("ahau");
}
int main()
{
    int l,i,d,m,n,y,sum,num=0,p,a[5001],b[5001],c[5001];
    char ss[21];
    scanf("%d",&n);
    p=n;
    while(n--)
    {
        scanf("%d. %s %d",&d,&ss,&y);
        m=fxs(ss);
        sum=y*365+(m-1)*20+d+1;
        if(sum%13==0)
            d=13;
        else
            d=sum%13;
        if(sum%20==0)
            m=20;
        else
            m=sum%20;
        if(sum%260==0)
            y=sum/260-1;
        else
            y=sum/260;
        a[num]=d;
        b[num]=m;
        c[num]=y;
        num++;
    }
    printf("%d\n",p);
    for(i=0;i<num;i++)
    {
        printf("%d ",a[i]);
        fxv(b[i]);
        printf(" %d\n",c[i]);
    }
    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