题意:两种纪年方法的转换

水题,根据题目翻译成代码就可以了

居然WA了一次,避坑,output要先输出数据组数,痛心疾首啊!本来可以一次AC的。

 package poj.ProblemSet;

 import java.util.Scanner;

 public class poj1008 {
public static final String[] Tzolkin_day = {"", "imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"}; public static int Month(String month) {
if (month.equals("pop")) return 0;
if (month.equals("no")) return 1;
if (month.equals("zip")) return 2;
if (month.equals("zotz")) return 3;
if (month.equals("tzec")) return 4;
if (month.equals("xul")) return 5;
if (month.equals("yoxkin")) return 6;
if (month.equals("mol")) return 7;
if (month.equals("chen")) return 8;
if (month.equals("yax")) return 9;
if (month.equals("zac")) return 10;
if (month.equals("ceh")) return 11;
if (month.equals("mac")) return 12;
if (month.equals("kankin")) return 13;
if (month.equals("muan")) return 14;
if (month.equals("pax")) return 15;
if (month.equals("koyab")) return 16;
if (month.equals("cumhu")) return 17;
return 18;//if(month=="uayet")
}
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
int n = cin.nextInt();
System.out.println(n);
for (int i = 1; i <= n; i++) {
int day = (int) cin.nextDouble();
String month = cin.next();
int year = cin.nextInt();
int x = (year * 365 + Month(month) * 20 + day);
int a = x % 13 + 1;
String b = Tzolkin_day[x % 20 + 1];
int c = (int) x / (13 * 20);
System.out.println(a + " " + b + " " + c);
}
}
}

Java-POJ1008-Maya Calendar的更多相关文章

  1. POJ1008 Maya Calendar

    题目来源:http://poj.org/problem?id=1008 题目大意: Maya人认为一年有365天,但他们有两种日历.一种叫做Haab,有19个月.前18个月每月20天,每个月的名字分别 ...

  2. 算法:POJ1008 Maya Calendar

    此题非常水,不做说明. package practice; import java.io.BufferedInputStream; import java.util.Scanner; /** * @a ...

  3. poj 1008:Maya Calendar(模拟题,玛雅日历转换)

    Maya Calendar Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 64795   Accepted: 19978 D ...

  4. POJ 1008 Maya Calendar

    链接:http://poj.org/problem?id=1008 Maya Calendar Time Limit: 1000MS   Memory Limit: 10000K Total Subm ...

  5. Maya Calendar 分类: POJ 2015-06-11 21:44 12人阅读 评论(0) 收藏

    Maya Calendar Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 70016   Accepted: 21547 D ...

  6. [POJ] #1008# Maya Calendar : 字符处理/同余问题

    一. 题目 Maya Calendar Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 74085   Accepted: 2 ...

  7. Poj OpenJudge 百练 Bailian 1008 Maya Calendar

    1.Link: http://poj.org/problem?id=1008 http://bailian.openjudge.cn/practice/1008/ 2.content: Maya Ca ...

  8. B - Maya Calendar(第二季水)

    Description During his last sabbatical, professor M. A. Ya made a surprising discovery about the old ...

  9. Java中的Calendar方法

    /** * @Title:JavaDate.java * @Package:com.yhd.chart.model * @Description:Java中的Calendar总结 * @author: ...

  10. Java中的Calendar日历用法详解

    第一部分 Calendar介绍 public abstract class Calendar implements Serializable, Cloneable, Comparable<Cal ...

随机推荐

  1. C# compare different Encoding pattern between UTF8 and UTF32 based on Md5

    using System; using System.Text; using System.IO; using System.Security.Cryptography; static void Ma ...

  2. JS Radio结合TEXT

    <script> function fun_a(value){ if(value === "on"){ document.getElementById('a').dis ...

  3. 常用ES6语法总结

    参考链接:http://es6.ruanyifeng.com/ const 声明一个只读的常量. 改变常量的值会报错.只声明不赋值也会报错.只在声明所在的块级作用域内有效.声明的常量不会提升,只能在声 ...

  4. github的版本控制master和branch develop

    一.git版本控制原理 master(主分支), develop(分支),虽然是主分支和分支,却是平级关系,develop可以理解为开发库,master为生产库. 本地版本:master, devel ...

  5. vue报错There are multiple modules with names that only differ in casing. This can lead to unexpected behavior when compiling on a filesystem with other case-semantic. Use equal casing. Compare these mod

    今天在开发一个新项目时,当安装完依赖包启动项目后报了一个这个错 There are multiple modules with names that only differ in casing.Thi ...

  6. 前端面试必备技巧(二)css盒模型及BFC

    CSS盒模型 基本概念:标准模型+IE模型及区别 CSS如何设置这两种模型? JS如何设置获取盒模型对应的宽和高? 实例题(根据盒模型解释边距重叠) BFC边距重叠解决方案 (1)BFC的基本概念:b ...

  7. XJOI CSP-S2 2019开放模拟训练题1 赛后总结

    比赛链接 友好数对 暴力枚举\([L,R]\)之间的所有数,将每个数进行"旋转",看是否符合题意. 注意"旋转"的次数,并不一定是数字位数.只要旋转回到了初始数 ...

  8. [USACO12FEB] 附近的牛 Nearby Cows - 树形dp,容斥

    给你一棵 \(n\) 个点的树,点带权,对于每个节点求出距离它不超过 \(k\) 的所有节点权值和 \(m_i\) 随便定一个根,设\(f[i][j]\)表示只考虑子树,距离为\(j\)的权值和,\( ...

  9. layui table 超出自动换行

    个人博客 地址:http://www.wenhaofan.com/article/20181120180507 layui 的table的的cell默认是超出hidden的,如果希望超出长度自动换行便 ...

  10. 给IDEA添加右键打开功能

    添加文件夹右键程序打开 开始运行regedit 找到 HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell 1.右键shell目录新建项Idea 2. ...