算法:POJ1008 Maya Calendar
此题非常水,不做说明。
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;
}
}
算法:POJ1008 Maya Calendar的更多相关文章
- POJ1008 Maya Calendar
题目来源:http://poj.org/problem?id=1008 题目大意: Maya人认为一年有365天,但他们有两种日历.一种叫做Haab,有19个月.前18个月每月20天,每个月的名字分别 ...
- [POJ] #1008# Maya Calendar : 字符处理/同余问题
一. 题目 Maya Calendar Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 74085 Accepted: 2 ...
- 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 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 ...
- POJ 1008 Maya Calendar / UVA 300【日期转换/常量数组】
Maya Calendar Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 82431 Accepted: 25319 Descr ...
- [POJ 1008] Maya Calendar C++解题
Maya Calendar Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 62297 Accepted: 192 ...
随机推荐
- mongo基本操作
创建数据库文件的存放位置,比如d:/mongodb/data/db.启动mongodb服务之前需要必须创建数据库文件的存放文件夹,否则命令不会自动创建,而且不能启动成功. 打开cmd(windows键 ...
- 使用ycsb测试cassandra
参考 https://github.com/cloudius-systems/osv/wiki/Benchmarking-Cassandra-and-other-NoSQL-databases-wit ...
- delegate notification kvo三者比较
IOS 如何选择delegate.notification.KVO? 前面分别讲了delegate.notification和KVO的实现原理,以及实际使用步骤,我们心中不禁有个疑问,他们的功能比较类 ...
- IntegerCache类
先看代码实例现象: 问题:为什么都是比较数值,第一个为true,第二个确为false呢? 查找源码(java.lang.Integer),看到如下代码: /** * Cache to support ...
- springboot使用之四:错误页面404处理建议
每个项目可能都会遇到404,403,500等错误代码,如没有错误页面,则会给用户一个很不友好的界面,springboot项目同样也存在这个问题. 但在官方文档并没有相关配置信息,这就要求我们自己来实现 ...
- eclipse开发环境搭建
1.eclipse插件OpenExplorer快速打开文件目录 下载地址:https://github.com/samsonw/OpenExplorer/downloads 下载jar包,将jar包放 ...
- yeoman(转)
前言有一种技术可以提高我们的工作效率,可以让我们专心做我们擅长的事,可以屏蔽复杂性,可以规范我们的架构和我们的代码,可以让我们的享受编程的乐趣.Yeoman可以做到. 很多年以前,rails刚刚出世, ...
- 初学 Java Web 开发,请远离各种框架,从 Servlet 开发
Web框架是开发者在使用某种语言编写Web应用服务端时关于架构的最佳实践.很多Web框架是从实际的Web项目抽取出来的,仅和Web的请求和响应处 理有关,形成一个基础,在开发别的应用项目的时候则可以从 ...
- [LeetCode]413 Arithmetic Slices
A sequence of number is called arithmetic if it consists of at least three elements and if the diffe ...
- Java/Android 二进制数据与String互转
将经过加密的二进制数据保存到本地的方法 byte[] src = new byte[] { 122,-69, -17, 92, -76, 52, -21, -87, -10, 105, 76, -75 ...