Java-POJ1008-Maya Calendar
题意:两种纪年方法的转换
水题,根据题目翻译成代码就可以了
居然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的更多相关文章
- POJ1008 Maya Calendar
题目来源:http://poj.org/problem?id=1008 题目大意: Maya人认为一年有365天,但他们有两种日历.一种叫做Haab,有19个月.前18个月每月20天,每个月的名字分别 ...
- 算法:POJ1008 Maya Calendar
此题非常水,不做说明. package practice; import java.io.BufferedInputStream; import java.util.Scanner; /** * @a ...
- poj 1008:Maya Calendar(模拟题,玛雅日历转换)
Maya Calendar Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 64795 Accepted: 19978 D ...
- POJ 1008 Maya Calendar
链接:http://poj.org/problem?id=1008 Maya Calendar Time Limit: 1000MS Memory Limit: 10000K Total Subm ...
- Maya Calendar 分类: POJ 2015-06-11 21:44 12人阅读 评论(0) 收藏
Maya Calendar Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 70016 Accepted: 21547 D ...
- [POJ] #1008# Maya Calendar : 字符处理/同余问题
一. 题目 Maya Calendar Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 74085 Accepted: 2 ...
- Poj OpenJudge 百练 Bailian 1008 Maya Calendar
1.Link: http://poj.org/problem?id=1008 http://bailian.openjudge.cn/practice/1008/ 2.content: Maya Ca ...
- B - Maya Calendar(第二季水)
Description During his last sabbatical, professor M. A. Ya made a surprising discovery about the old ...
- Java中的Calendar方法
/** * @Title:JavaDate.java * @Package:com.yhd.chart.model * @Description:Java中的Calendar总结 * @author: ...
- Java中的Calendar日历用法详解
第一部分 Calendar介绍 public abstract class Calendar implements Serializable, Cloneable, Comparable<Cal ...
随机推荐
- 关于GET和POST请求的区别,最通俗全面的回答
GET和POST是HTTP请求的两种基本方法,要说它们的区别,接触过WEB开发的人都能说出一二. 最直观的区别就是GET把参数包含在URL中,POST通过request body传递参数. 你可能自己 ...
- Android studio中修改xml文件无效问题
昨天遇到的这个问题,在修改布局xml文件后保存,但运行时布局却并没有被修改,也就是说我的修改无效,今天参照了这篇文章中的方法终于解决了: https://blog.csdn.net/l_o_s/art ...
- 【spring】spring源码阅读之xml读取、bean注入(BeanFactory)
前言 此源码其实是在4月中旬就看了,而且当初也写了一份word文档,但不打算直接把word发上来.还是跟着以前的笔记.跟踪代码边看边写吧. 其实当初看源码的理由很简单,1.才进新公司,比较有空闲.2. ...
- Deepin Linux 升级wine应用
前提是升级已经安装的wine应用 参考: 微信升级 mkdir /tmp/wechat cd /tmp/wechat wget https://dldir1.qq.com/weixin/Windows ...
- html中引入调用另一个html文件
第一种: <body> <div id="page1"></div> <div id="page2"></ ...
- Educational Codeforces Round 65 (Rated for Div. 2)B. Lost Numbers(交互)
This is an interactive problem. Remember to flush your output while communicating with the testing p ...
- Struts2学习-struts.xml文件配置
学习框架过程中,一直对框架中的配置文件比较难理解,特搜集资料简要记录一下struts.xml文件遇到的问题. <?xml version="1.0" encoding=&qu ...
- Oracle VM VirtualBox - VBOX_E_FILE_ERROR (0x80BB0004)
问题描述: 导入虚拟电脑 D:\LR\虚拟机相关\CentOS-6.7-x86_64-2G-40G-oracle-IP9\CentOS-6.7-x86_64-2G-40G-oracle-IP9.ovf ...
- 清除ios系统alert弹出框的域名
清除ios系统alert弹出框的域名 <script> window.alert = function(name) { var iframe = document.createElemen ...
- 风变编程笔记(二)-Python爬虫精进
第0关 认识爬虫 1. 浏览器的工作原理首先,我们在浏览器输入网址(也可以叫URL),然后浏览器向服务器传达了我们想访问某个网页的需求,这个过程就叫做[请求]紧接着,服务器把你想要的网站数据发送给浏 ...