此题非常水,不做说明。
package practice; import java.io.BufferedInputStream;
import java.util.Scanner; /**
* @author caiyu
* @date 2014-12-2
*/
public class POJ1008 {
static final String[] HaabMonth = new String[] { "pop", "no", "zip",
"zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac",
"ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu", "uayet" };
static final String[] TzolkinMonth = new String[] { "imix", "ik", "akbal",
"kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok",
"chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab",
"canac", "ahau" }; /**
* @param args
*/
public static void main(String[] args) { Scanner cin = new Scanner(new BufferedInputStream(System.in));
int t = cin.nextInt();
for (int i = 0; i < t; i++) {
float d = cin.nextFloat();
String m = cin.next();
int y = cin.nextInt();
System.out.println(convert(d, m, y));
}
} private static String convert(float d, String m, int y) {
int md = 0;
for (int i = 0; i < HaabMonth.length; i++) {
if (HaabMonth[i].equals(m)) {
md = i * 20;
}
}
int days = y * 365 + (int) d + md;
return days % 13 + 1 + " " + TzolkinMonth[days % 20] + " " + days / 260;
}
}