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 LXpeng at 2008-04-09 12:30:24 on Problem 1008
#include <iostream>
#include <string>
using namespace std;
const int N=700;

int main(){
	int n;     //输入个数
	int m,i;
	int d[N],f[N];
	char e[N][9];
	int s;     //日数
	int a,c;   //日 年
	char b[9]; //月
	char h[19][9]={
		"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax",
        "zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"
	};
	char t[20][9]={
        "imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok",
        "chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"
	};
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d. %s %d",&a,&b,&c);
		for(m=0;m<19;m++)
			if(strcmp(b,h[m])==0)
				break;
		s=a+m*20+c*365;
		if(s==0){
			d[i]=1;
			strcpy(e[i],t[0]);
			f[i]=0;
		}
		else{
			d[i]=s%13+1;
			strcpy(e[i],t[s%20]);
			f[i]=s/260;
		}
	}
	printf("%d\n",n);
	for(i=0;i<n;i++){
		printf("%d %s %d\n",d[i],e[i],f[i]);
	}
	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