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 bjss222 at 2007-04-05 20:14:43 on Problem 1008
In Reply To:Re:输入格式错误哪位大牛帮忙修改一下,不胜感激! Posted by:bjss222 at 2007-04-05 20:13:20
#include<stdio.h>
#include<string.h>
char Ma[][10]={"0","pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", 
               "mac", "kankin", "muan", "pax", "koyab", "cumhu","uayet"};
char Tz[][10]={"ahau","imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok",
              "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac"};
int main(){
	int n,a[262]={0},j=1,l=0;
	for(int i=1; i<261;i++,j++){
        a[i]=j;
		if(j==13) j=0;
	}
	scanf("%d",&n);
	while(n-->0){
		int d,y,sum,k;
		char m[10];
		scanf("%d.%s%d",&d,m,&y);
        for(i=0; i<=20;i++)	if(strcmp(Ma[i],m)==0) {k=i; break;}
	    sum=y*365+(k-1)*20+d+1;
		y=sum/260;   
		sum=sum%260;   
		if(l++==0) printf("%d\n",n+1);
	    if(sum==0)   printf("13 ahau %d\n",y-1);  
		else printf("%d %s %d\n",a[sum],Tz[sum%20],y);
	}
	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