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

跪求测试数据,一直wrong................

Posted by 1095625014 at 2017-08-22 11:46:44 on Problem 1008
#include <stdio.h>
#include <string.h>
char m[20][10]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
struct Haab
{
	int day;
	char month[10];
	int year;
}a;

struct Tzolkin
{
	int number;
	char word[10];
	int year;
}b;

int choose(char *month)
{
	if(strcmp(month,"pop")==0) return 0;
	if(strcmp(month,"no")==0) return 1;
	if(strcmp(month,"zip")==0) return 2;
	if(strcmp(month,"zotz")==0) return 3;
	if(strcmp(month,"tzec")==0) return 4;
	if(strcmp(month,"xul")==0) return 5;
	if(strcmp(month,"yoxkin")==0) return 6;
	if(strcmp(month,"mol")==0) return 7;
	if(strcmp(month,"chen")==0) return 8;
	if(strcmp(month,"yax")==0) return 9;
	if(strcmp(month,"zac")==0) return 10;
	if(strcmp(month,"ceh")==0) return 11;
	if(strcmp(month,"mac")==0) return 12;
	if(strcmp(month,"kankin")==0) return 13;
	if(strcmp(month,"muan")==0) return 14;
	if(strcmp(month,"pax")==0) return 15;
	if(strcmp(month,"koyab")==0) return 16;
	if(strcmp(month,"cumhu")==0) return 17;
	if(strcmp(month,"uayet")==0) return 18;
}

long long count(struct Haab *a)
{
	long long sum=0;
	struct Haab t=*a;
	sum=sum+365*t.year+20*choose(t.month)+t.day+1;
	return sum;
}

void trans(long long s,struct Tzolkin *b)
{
	b->year=s/260;
	s=s%260;
	if(s==0)
	{
		b->year-=1;
		b->number=13;
		strcpy(b->word,m[19]);
	}
	else
	{
		int i,j=1,k=0;
		b->number=s%13;
		strcpy(b->word,m[s%20-1]);
	}
}

int main()
{
	int n;
	while(scanf("%d",&n)!=EOF)
	{
		printf("%d\n",n);
		while(n--)
		{
			scanf("%d.%s %d",&a.day,a.month,&a.year);
			long long s=count(&a);
			trans(s,&b);
			printf("%d %s %d\n",b.number,b.word,b.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