| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
就这样吧...,鸡巴到底怎么回事儿?看不起我写的代码儿?大神看看怎么回事儿,ORZimport 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator