参考:https://blog.csdn.net/u011392408/article/details/28866779

https://blog.csdn.net/qq_36424540/article/details/78234240

 #include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int d,y;
string s;
//string sh[]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu"};
//string st[]={"","imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
char sh[][]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};//用strig数组过不了,望来个大神解答一下!
char st[][]={"","imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
int turn(int dd,string ss,int yy)//求总的天数
{
int days,i;
for (i=;ss!=sh[i];i++);
days=*i+dd+yy*;
return days;
}
int main()
{
int t;
// freopen("F:\\ACM\\text.txt","r",stdin);
while (cin>>t)
{
cout<<t<<endl;
while (t--)
{
char c;
cin>>d>>c>>s>>y;
int real=turn(d,s,y)+;
int yt=real/,days=real%;//yt为转化后的年
if (days==)
{
yt--;
days=;
}
int dt=days%;//int dt=days%13+1,dn=days%20+1这样写是不对的!
if (dt==)
{
dt=;
}
int dn=days%;
if (dn==)
{
dn=;
}
cout<<dt<<' '<<st[dn]<<' '<<yt<<endl;
}
} return ;
}

【POJ】1008 Maya Calendar的更多相关文章

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

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

  2. POJ 1008 Maya Calendar

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

  3. 【POJ】1704 Georgia and Bob(Staircase Nim)

    Description Georgia and Bob decide to play a self-invented game. They draw a row of grids on paper, ...

  4. 【POJ】1067 取石子游戏(博弈论)

    Description 有两堆石子,数量任意,可以不同.游戏开始由两个人轮流取石子.游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子:二是可以在两堆中同时取走相同数量的石子.最后 ...

  5. 【C#】wpf自定义calendar日期选择控件的样式

    原文:[C#]wpf自定义calendar日期选择控件的样式 首先上图看下样式 原理 总览 ItemsControl内容的生成 实现 界面的实现 后台ViewModel的实现 首先上图,看下样式 原理 ...

  6. 【LeetCode】731. My Calendar II 解题报告(Python)

    [LeetCode]731. My Calendar II 解题报告(Python) 作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题 ...

  7. 【LeetCode】732. My Calendar III解题报告

    [LeetCode]732. My Calendar III解题报告 标签(空格分隔): LeetCode 题目地址:https://leetcode.com/problems/my-calendar ...

  8. 【LeetCode】729. My Calendar I 解题报告

    [LeetCode]729. My Calendar I 解题报告 标签(空格分隔): LeetCode 题目地址:https://leetcode.com/problems/my-calendar- ...

  9. POJ 1008 Maya Calendar / UVA 300【日期转换/常量数组】

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

随机推荐

  1. php 获取毫秒时间戳

    function getMsec(){//返回毫秒时间戳 $arr = explode(' ',microtime()); $hm = 0; foreach($arr as $v){ $hm += f ...

  2. 林锐书:写一个hello world by seasoned professional

    #include <iostream> #include <string.h> using namespace std; class String { private: int ...

  3. 长大Tips

    队名:CW 队员: B20150304403 王香辉 B20150304408 李孟君 B20150304411 曾翡 B20150304414 吴海波 B20150304430 文淼 B201503 ...

  4. 如何使用代码获得一个function module的Where Used List

    如果要获得一个function module的Where Used List,我们通常用的办法是使用ABAP workbench里提供的功能. where used list显示结果如下: 但我接到一 ...

  5. Android(java)学习笔记46:反射机制

    1. 反射机制: JAVA反射机制是在运行状态中,对于任意一个类,都能够知道这个类的所有属性和方法:对于任意一个对象,都能够调用它的任意一个方法和属性:这种动态获取的信息以及动态调用对象的方法的功能称 ...

  6. 腾讯2016校招编程题【PHP实现】

    2016腾讯春招的编程题 话不多说,直接上题!!! 给定一个字符串s,你可以从中删除一些字符,使得剩下的串是一个回文串.如何删除才能使得回文串最长呢?输出需要删除的字符个数 . 这道题是以回文为载体, ...

  7. c++一些总结

    1.if和else if后面并没有要求一定要接else(即以else来结尾),可以直接if语句然后接其他语句,也可以if语句之后加else if语句再接其他语句

  8. NodeJS学习日记--环境配置及项目初始化

    在node.js官网下载nodejs安装包 安装完成后打开控制台,输入 npm -version 如果正确显示npm版本则安装成功. 创建项目之前先要安装以下全局扩展模块 npm install -g ...

  9. File,FileInfo,Directory,DirectoryInfo

    两者的共同点:  一:都用于典型的操作,如复制.移动.重命名.创建.打开.删除和追加到文件   二:默认情况下,将向所有用户授予对新文件的完全读/写访问权限.  两者的区别:   File类是静态类, ...

  10. java 注解annotation的使用,以及反射如何获取注解

     一.注解基本知识 1.元注解 元注解是指注解的注解.包括  @Retention @Target @Document @Inherited四种. 1. Annotation型定义为@interfac ...