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 13lazyrainy at 2007-05-27 16:03:24 on Problem 1008
#include<stdio.h>
#include<string.h>
int main()
{
	char m[19][10] { "pop", "no", "zip", "zotz", "tzec","xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu","uayet"};
    char d[20][10] = { "imix", "ik",  "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"};

	int n,k,i,num;
	int month,year=0,day;
	long int date;
	char temp[10];
	scanf("%d",&n);
	printf("%d\n",n);
	for (k=0;k<n;k++)
	{
	   date=0;
	   scanf("%d",&day);
	   getchar();
	   getchar();
       scanf("%s",temp);
	   
	   for (i=0;i<19;i++)
	       if (strcmp(temp,m[i])==0) break;
	   month=i;
	   scanf("%d",&year);
	   if (month!=18)
	   date=year*365+month*20+day;
	   else date=year*365+20*18+day;

	   year=date/260;
	   num=date%13+1;

	   date=date%260;
	   if (!date) printf("%d imix %d\n",num,year);
	   else
	   {
		   day=date%20;
		   if (!day) day=20;
		   printf("%d %s %d\n",num,d[day],year);
	   }
	}

    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