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

就这样吧...,鸡巴到底怎么回事儿?看不起我写的代码儿?大神看看怎么回事儿,ORZ

Posted by 834208094 at 2012-04-18 22:42:46 on Problem 1008
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.util.*;

public class Main {
	
	public static ArrayList al = new ArrayList();
	public static int  chengestyle(String str) {
		int num = 0;
		String months[] = {"pop", "no", "zip", "zotz", "tzec", 
				"xul", "yoxkin", "mol", "chen", "yax", "zac",
				"ceh", "mac", "kankin", "muan", "pax", 
				"koyab", "cumhu"," uayet"};
		for(int i=0; i<months.length; i++) {
			if(str.equals(months[i])) {
				num = i;
				break;
			}	
		}
		return num;
	}
	
	public static String  translate(int days) {
	    int reminder;
		int year;
	    int num;
		int day;
	    String str = "";
		String days1[] = { "imix", "ik", "akbal",
				"kan", "chicchan", "cimi", "manik"
				, "lamat", "muluk", "ok", "chuen"
				, "eb", "ben", "ix", "mem", "cib"
				, "caban", "eznab", "canac", "ahau"};
		reminder = days % 260;
		year = days / 260;
	    if(days % 13 == 0) {
	    	num = 13;
	    }else {
	    	num = days % 13;
	    }
		if( reminder % 20 != 0) {
			day = reminder % 20;
		}else {
			day = 20;
		}
		str = num + " " + days1[day - 1] + " " + year;
		return str;
	}
	
	public static void main(String[] args) {
		File f = new File("D:\\test.txt");
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		System.out.println(str);
		int days = 0;
		while(sc.hasNextLine()) {
			String s = sc.nextLine().replace('.', ' ').replace("  ", " ");
			String[] date = s.split(" ");
			days = Integer.parseInt(date[0])  + 1 + chengestyle(date[1]) * 20
					+ 365 * (Integer.parseInt(date[2])); 
			al.add(translate(days));
		}
		System.out.print(al.get(0));
		for(int i=1; i<al.size(); i++) {
			System.out.println();
			System.out.print(al.get(i));	
		}
	}
}

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