算法:POJ1008 Maya Calendar

时间:2022-03-11 05:51:32

此题非常水,不做说明。

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的更多相关文章

  1. POJ1008 Maya Calendar

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

  2. &lbrack;POJ&rsqb; &num;1008&num; Maya Calendar &colon; 字符处理&sol;同余问题

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

  3. poj 1008&colon;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&colon;44 12人阅读 评论&lpar;0&rpar; 收藏

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

  6. Poj OpenJudge 百练 Bailian 1008 Maya Calendar

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

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

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

  8. POJ 1008 Maya Calendar &sol; UVA 300【日期转换&sol;常量数组】

    Maya Calendar Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 82431 Accepted: 25319 Descr ...

  9. &lbrack;POJ 1008&rsqb; Maya Calendar C&plus;&plus;解题

        Maya Calendar Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 62297   Accepted: 192 ...

随机推荐

  1. OpenCascade Matrix

    OpenCascade Matrix eryar@163.com 摘要Abstract:本文对矩阵作简要介绍,并结合代码说明OpenCascade矩阵计算类的使用方法. 关键字Key Words:Op ...

  2. Restful api介绍

    网络应用程序,分为前端和后端两个部分.当前的发展趋势,就是前端设备层出不穷(手机.平板.桌面电脑.其他专用设备......). 因此,必须有一种统一的机制,方便不同的前端设备与后端进行通信.这导致AP ...

  3. UTF-8-BOM

    https://www.zhihu.com/question/20167122 知乎 「带 BOM 的 UTF-8」和「无 BOM 的 UTF-8」有什么区别?网页代码一般使用哪个? http://b ...

  4. MySQL的批处理

    MySQL默认是关闭批处理的,所以我们在默认状态下(批处理未打开)向数据库中存入10000条数据,核心代码如下: package cn.itcast.demo5; import java.sql.Co ...

  5. win32 api 文件操作!

    CreateFile打开文件要对文件进行读写等操作,首先必须获得文件句柄,通过该函数可以获得文件句柄,该函数是通向文件世界的大门. ReadFile从文件中读取字节信息.在打开文件获得了文件句柄之后, ...

  6. Java基础知识强化32:String类之String类的判断功能

    1. String类的判断功能: boolean equals (Object obj ) boolean equalsIgnoreCase (String str ) boolean contain ...

  7. MSSQL - 存储过程事物

    效果: 创建带有事物的存储过程: use sales --指定数据库 create table bb --创建bb 这个表 ( ID int not null primary key ,--账号 Mo ...

  8. Inno Setup入门(十九)&mdash&semi;&mdash&semi;Inno Setup类参考(5)

    : Install Setup 2013-02-02 11:29 377人阅读 评论(0) 收藏 举报 单选按钮 单选按钮在安装中也很常见,例如同一个程序可以选择安装不同的性质的功能,例如选择32位或 ...

  9. TxDragon的训练5

    Solution 代码:由乃: //MADE BY QT666 #include<iostream> #include<cstdio> #include<algorith ...

  10. &period;NET redis cluster

    一.下载Windows版本Redis 下载链接:https://github.com/MSOpenTech/redis/releases(根据系统选择对应版本) 二.修改默认的配置文件 如上图两个配置 ...