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

大神帮忙看看 测试了我能找到的所有数据都是正确的,提交却是runtime error,无力了跪求帮看了!!!!

Posted by candycloud at 2013-10-28 15:10:23 on Problem 1008
#include<iostream>
#include<string>
#include<string.h>
using namespace std;


bool equal(char *s1, char *s2){
	int i = 0;
	while((s1[i] == s2[i])&& (s1[i] != '\0')){
		++i;
	}
	if((s1[i] == '\0')&& (s2[i] == '\0')){
		return true;
	}else{
		return false;
	}
}

struct node{
	int year;
	int month;
	int day;
	node(int i = 0, int j = 0, int k = 0){
		year = i;
		month = j;
		day = k;
	}
};

int days(int day, char *month, int year){
	char *s[] = {"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu","uayet"};
	int m = 0;
	while(!equal(month, s[m])){
		++m;
	}
	int days = m*20 + day + 365*year + 1;

	return days;
}

node print(int days){
	int year = days/260;
	int flag = 0;
	if(year*260 == days){
		year = year - 1;
		flag = 1;
	}
	int day;
	int num;
	if(flag){
		day = 19;
		num = 13;
	}else{
		day = ((days - 260*year)%20 - 1);
		num = (days - 260*year)%13;
	}

	if(num == 0){
		num = 13;
	}
	node p;
	p.day  = num;
	p.year = year;
	p.month = day;
	return p;
}

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