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
北京大学《ACM/ICPC大学生程序设计竞赛训练》暑期课面向全球招生!

我也通过了,但还是WA 啊!!再给几组吧????

Posted by lengzhigang at 2009-08-20 13:27:06 on Problem 1008
In Reply To:Re:也通过了,但还是WA 啊!!再给几组吧???? Posted by:qichao at 2009-07-24 12:00:34
这组我也通过了,但还是WA,请高手帮忙啊

我的代码如下:






#include<stdio.h>
#include<string.h>

void tran(int Hday,char *q,int Hyear)
{
	int i=0,yu,Ti,Tyear,Tday;
	long int allday;
     char *mon[20]= {"imix","ik","akbal","kan","chichan","cimi","manik",
                       "lamat","mulak","ok","chuen","eb","ben","ix","mem","cib","caban",
                       "eznab","canac","ahau"};
     char *m[19]={"pop","no","zip","zotz","tzec", "xul","yoxkin","mol","chen","yax","zac",
 		"ceh","mac","kankin","muan","pax","koyab","cumhu", "uayet"};
     
		 while(strcmp(m[i],q)!=0)
                              i++;
		    allday=Hyear*365+i*20+Hday+1;
    Tyear=allday/260;
    if(allday%20==0) Tyear=Tyear-1;
	 else   yu=allday%260;
	if(yu%13==0) Tday=13;
      else Tday=yu%13;
    if(yu%20==0) Ti=20;
	  else  Ti=yu%20;
	printf("%d %s %d\n",Tday,mon[Ti-1],Tyear);

}

int main()
{
  int a, b, Hday, Hyear;
  char p[20];
  scanf("%d",&b);
  printf("%d\n",b);
  for(a=0;a<b;a++)
  {  scanf("%d.%s%d",&Hday,p,&Hyear);
      tran(Hday,p,Hyear);

  }
  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