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

只用 0 MS

Posted by clarencezi at 2011-05-16 18:42:14 on Problem 1008
#include"stdio.h"
#include"string.h"
main()
{
	int d,y,re,dd,yy[5001],a[5001],b[5001],swi,n,i;
	char w,m[10],mm[20][10]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
	long sum;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{  sum=0;
	   scanf("%d%c%s%d",&d,&w,m,&y);
	   sum+=d;sum+=365*y;
	   if(strcmp("pop",m)==0) swi=1;
	   if(strcmp("no",m)==0) swi=2;
	   if(strcmp("zip",m)==0) swi=3;
	   if(strcmp("zotz",m)==0) swi=4;
	   if(strcmp("tzec",m)==0) swi=5;
	   if(strcmp("xul",m)==0) swi=6;
	   if(strcmp("yoxkin",m)==0) swi=7;
	   if(strcmp("mol",m)==0) swi=8;
	   if(strcmp("chen",m)==0) swi=9;
	   if(strcmp("yax",m)==0) swi=10;
	   if(strcmp("zac",m)==0) swi=11;
	   if(strcmp("ceh",m)==0) swi=12;
	   if(strcmp("mac",m)==0) swi=13;
	   if(strcmp("kankin",m)==0) swi=14;
	   if(strcmp("muan",m)==0) swi=15;
	   if(strcmp("pax",m)==0) swi=16;
	   if(strcmp("koyab",m)==0) swi=17;
	   if(strcmp("cumhu",m)==0) swi=18;
	   if(strcmp("uayet",m)==0) swi=19;
       switch(swi)
	   {
	    case 1:sum+=0;break;
		case 2:sum+=20;break;
		case 3:sum+=40;break;
		case 4:sum+=60;break;
		case 5:sum+=80;break;
		case 6:sum+=100;break;
		case 7:sum+=120;break;
		case 8:sum+=140;break;
		case 9:sum+=160;break;
		case 10:sum+=180;break;
		case 11:sum+=200;break;
		case 12:sum+=220;break;
		case 13:sum+=240;break;
		case 14:sum+=260;break;
		case 15:sum+=280;break;
		case 16:sum+=300;break;
		case 17:sum+=320;break;
		case 18:sum+=340;break;
		case 19:sum+=360;break;
	   }
        yy[i]=sum/260;
	    re=sum%260;
	    a[i]=re%20;
        b[i]=re%13;
	}
	printf("%d\n",n);
	for(i=0;i<n;i++)
	  printf("%d %s %d\n",b[i]+1,mm[a[i]],yy[i]);
}

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