北大ACM(POJ1008-Maya Calendar)
Question:http://poj.org/problem?id=1008
问题点:日历转换。
Memory: 280K Time: 16MS
Language: C++ Result: Accepted #include <iostream>
#include <string.h>
#include <malloc.h> using namespace std;
const char* Haab_Month[]={
"pop", "no", "zip", "zotz", "tzec", "xul",
"yoxkin", "mol", "chen", "yax", "zac", "ceh",
"mac", "kankin", "muan", "pax", "koyab", "cumhu","uayet"
};
const char* Tzolkin_DayName[]={
"imix", "ik", "akbal", "kan", "chicchan",
"cimi", "manik", "lamat", "muluk", "ok",
"chuen", "eb", "ben", "ix", "mem",
"cib", "caban", "eznab", "canac", "ahau"
};
struct Haab{
int day;
int month;
int year;
};
struct Tzolkin{
int day;
int dayn;
int year;
};
int main()
{
int N;
cin>>N;
cout<<N<<endl;
for(int i=;i<N;i++)
{
Haab h1;
float day;
char *month=(char *)malloc(sizeof(char)*);
cin>>day>>month>>h1.year;
h1.day=(int)day;
for(int j=;j<;j++)
{
if(strcmp(month,Haab_Month[j])==)
{
h1.month=j;
break;
}
}
int cnt=h1.year*+h1.month*+h1.day;
Tzolkin b1;
b1.year=cnt/;
b1.dayn=cnt%;
b1.day=cnt%+;
cout<<b1.day<<" "<<Tzolkin_DayName[b1.dayn]<<" "<<b1.year<<endl;
}
return ;
}
北大ACM(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 ...
- 北大 ACM 分类 汇总
1.搜索 //回溯 2.DP(动态规划) 3.贪心 北大ACM题分类2009-01-27 1 4.图论 //Dijkstra.最小生成树.网络流 5.数论 //解模线性方程 6.计算几何 //凸壳.同 ...
- 北大ACM - POJ试题分类(转自EXP)
北大ACM - POJ试题分类 -- By EXP 2017-12-03 转载请注明出处: by EXP http://exp-blog.com/2018/06/28/pid-38/ 相关推荐文: 旧 ...
- 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 ...
随机推荐
- 数据对象ajax学习篇9
题记:写这篇博客要主是加深自己对数据对象的认识和总结实现算法时的一些验经和训教,如果有错误请指出,万分感谢. 对ajax工作道理: 下面这段是来自一个网友的blog: Ajax的道理简单来说通过Xml ...
- Android Studio系列教程一--下载与安装
背景 相信大家对Android Studio已经不陌生了,Android Studio是Google于2013 I/O大会针对Android开发推出的新的开发工具,目前很多开源项目都已经在采用,Goo ...
- openlayers3 在地图上叠加WFS查询矢量图层
随着终端设备计算能力的加强,用户在使用地图的时候也须要越来越多的交互效果. 比方如今非常火的室内导航,为了获得好的用户体验,就须要当用户单击某一商店的时候该商店的颜色能对应的变化.这就须要叠加矢量图层 ...
- Delphi开发OCX详细步骤总结
首先要弄明白你要写的OCX是用在客户端还是用在服务器端 假如用在客户端: 1.创建 打开delphi 7,选择菜单"new"->"other"- ...
- 能在你离开时照顾你的宠物的3D打印机器人
您的宠物很可爱吧,您要离开时怎么办?找宠物公司来照顾他们?现在不用了.加拿大大学生推出了其3D打印的宠物机器人PetBot,它能照顾您的宠物,让您远程监控宠物,并能让您和宠物互动. “有 些人认为宠物 ...
- iOS开发——UI篇Swift篇&UIPickerView
UIPickerView //返回按钮事件 @IBAction func backButtonClick() { self.navigationController?.popViewControlle ...
- 【windows socket+TCPserverclient】
Windows Socket+TCPserverclient Winsock是 Windows下套接字标准. Socket套接字基于计算机网络,提供同一系统上不同进程或由局 ...
- c#无损高质量压缩图片
这几天在做同城交友网www.niyuewo.com时遇到的一个问题,如何将会员的头像压缩,在网上搜索整理如下:在此也感谢医药精(www.yiyaojing.com)站长的帮忙 /// <summ ...
- GifCam
转载:http://blog.bahraniapps.com/?page_id=21 下载 http://pan.baidu.com/s/1c0vdHIw GifCam Note:GifCam c ...
- 如何制作gif动画,丰富自己的博客?
不久前在博客园上看到有个哥们发表了一篇博客,其中使用了大量的动态的gif动画,感觉这种方法对于丰富博客内容非常有帮助,然后在网上搜索了一些关于制作gif动画的资料.我的方法不一定好,在这里仅作为抛砖引 ...