北大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 ...
随机推荐
- c# ActiveX 控件的开发
关于ActiveX控件的开发,网上很多例子,昨天也整整研究一天才捋顺了. 网上大部分例子都是js调用控件的方法,由于要实现在html页面"相应"控件的事件,整整折腾一天. 关键点在 ...
- Codeforces Round #336 (Div. 2)A. Saitama Destroys Hotel 水题
A. Saitama Destroys Hotel 题目连接: http://www.codeforces.com/contest/608/problem/A Description Saitama ...
- 4K加速普及,8K近在咫尺,下一个是?
从铺天盖地的厂商宣传到亲戚朋友家的客厅.不可否认4K时代已全面到来------业内人士估计2015年是4K电视的一个突破年.知名市场调查机构StrategyAnalytics对4K电视进行了调 ...
- LINUX CACHE IO THREAD
http://www.penglixun.com/tech/system/linux_cache_discovery.html http://my.oschina.net/HardySimpson/b ...
- RHEL 7 命令行注册和激活订阅服务
导读 前一阵子,红帽推出了开发者免费使用订阅功能,只要注册成为红帽开发者就可以免费使用包括 RHEL7 在内的开发套件. 今天我们就来看一看怎么使用命令行来快速注册和激活订阅服务,以后就可以方便地 ...
- Disable right click on the website
Many developers/website owners like to keep their website images personal and don't want anyone to c ...
- 10 ways to be a faster code reviewer--reference
reference:http://blog.codacy.com/top-10-faster-code-reviews/ This is a blog post of our Code Reading ...
- The Kernel Newbie Corner: Kernel Debugging with proc "Sequence" Files--Part 3
转载:https://www.linux.com/learn/linux-career-center/44184-the-kernel-newbie-corner-kernel-debugging-w ...
- 使用getUserMedia 调用摄像头
html5中一个有趣的 API,能够调用电脑的摄像头,结合 <video> 标签和 Canvas 就能在浏览器中拍摄照片了. 这里需要注意: 因为安全问题, chrome 对于本地文件禁用 ...
- storm 分组
Stream Groupings: Stream Grouping定义了一个流在Bolt任务间该如何被切分.这里有Storm提供的6个Stream Grouping类型: 1. 随机分组(Shuffl ...