POJ1008

问题描述###

在玛雅两种日历间转换,
Habb

每年364天,总共19个月
前18个月:
"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu"
每个月20天
最后一个月(uayet)5天
起始值为:0, 而非1

Tzolkin

没有固定月,而是用1~13和20个名字合起来组成一年
每一年13*20 = 260天
数值为:1~13
名字为:"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"
例如:一个循环是
1 imix, 2 ik, 3 akbal, 4 kan, 5 chicchan, 6 cimi, 7 manik, 8 lamat, 9 muluk, 10 ok, 11 chuen, 12 eb, 13 ben, 1 ix, 2 mem, 3 cib, 4 caban, 5 eznab, 6 canac, 7 ahau, and again in the next period 8 imix, 9 ik, 10 akbal . . .


难点###

没有~


代码实现###

`
package poj;
import java.util.Scanner;
public class Poj1008 {
public static void main(String[] args) {
String[] habb = {"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu"};
String[] tzolkin = {"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"};
Scanner sc = new Scanner(System.in);
int n = Integer.valueOf(sc.nextLine());
System.out.println(n);
for(int i = 0 ; i < n ; i ++){
String tmp = sc.nextLine();
String[] ss = tmp.split(" ");
int hDay = Integer.parseInt(ss[0].substring(0, ss[0].length()-1));
String hMonthS = ss[1];
int hMonth;
for(hMonth = 0; hMonth < habb.length; hMonth ++){
if(hMonthS.equals(habb[hMonth])){
break;
}
}
int hYear = Integer.parseInt(ss[2]);
int sumDay = hYear * 365 + hMonth * 20 + hDay;
int tYear = sumDay / 260;
String tMonth = tzolkin[sumDay % 260 % 20];
int tDay = sumDay % 260 % 13 + 1;
System.out.println(tDay+" "+tMonth+" "+tYear);

    }
    sc.close();
}

}

`

你可能感兴趣的:(POJ1008)