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

用java写的,本地完美运行,提交却是compile error,至今没有一道题提交ac,能帮忙解释下吗?

Posted by guozhi at 2010-08-14 15:41:47 on Problem 1008
import java.util.*;
import java.io.*;

public class Main {
	public static int getnum(String s){
		String arr[] ={"pop", "no", "zip", "zotz", "tzec", "xul", 
				"yoxkin","mol", "chen", "yax", "zac", "ceh", 
				"mac", "kankin", "muan", "pax", "koyab", "cumhu"};
		for(int i=0;i<arr.length;i++)
			if(arr[i].equals(s))return i+1;
		return 0;
		}
	public static String getmon(int n){
		String arr[]={"imix", "ik", "akbal", "kan", "chicchan","cimi", 
				"manik","lamat","muluk","ok","chuen","eb","ben","ix", 
				"mem","cib","caban","eznab","canac","ahau"};
		return arr[n-1];
	}
	public static void main(String[] args) throws Exception {
		Scanner cin = new Scanner(System.in);
		int max=0;
		max = cin.nextInt();
		System.out.println(max);
		while(max--!=0){
			int day = (int)cin.nextFloat();
			String month = cin.next();
			int year = cin.nextInt();
			int Haab = year*365+(getnum(month)-1)*20+(day+1);
			int Tzolkin_year = Haab/260;
			int tmp = Haab%260;
			if(tmp==0){
				System.out.println("13"+" ahau "+(Tzolkin_year-1));
			}
			int Tzolkin_day = tmp%13;
			if(Tzolkin_day==0) Tzolkin_day=13;
			int Tzolkin_mon_num = tmp%20;
			if(Tzolkin_mon_num == 0) Tzolkin_mon_num= 20;
			String Tzolkin_mon = getmon( Tzolkin_mon_num );
			System.out.println(Tzolkin_day+" "+Tzolkin_mon+" "+Tzolkin_year);
		}

	}
}

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