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

RE咯~!好心大虾帮忙看一下代码~!谢谢~

Posted by leoz0610 at 2009-03-10 21:42:01 on Problem 1008
#include<stdio.h>
#include<string.h>
int main(void)
{
int n,i,num[50],m[50],year[50],j;
int day[50];
char s[9];
char month[][9]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu"};
char h[][9]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
scanf("%d",&n);
for(i=0;i<n;i++)
 {scanf("%d. %s %d",&num[i],&s,&year[i]);
  for(j=0;j<19;j++)
  {if(strcmp(s,month[j])==0)
    break;
  }
  day[i]=num[i]+j*20+year[i]*365;
    num[i]=day[i]%13+1;
    m[i]=day[i]%20;
    year[i]=day[i]/260;
    }
    printf("%d\n",n);
    for(i=0;i<n;i++)
    { printf("%d %s %d\n",num[i],h[m[i]],year[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