POJ1008Maya Calendar
http://poj.org/problem?id=1008&lang=default&change=true
这个题倒是不难,就是麻烦一点,但是还WA了几次都是因为处理天数的时候没处理好,因为Haab这个日历日期是从0开始的,所以当第一年的最后一天第364天,而如果输入的恰好是365天应该是第二年的,所以,那个天数要放在下面处理
- #include<cstdio>
- #include<cstring>
- #include<iostream>
- using namespace std ;
- int main()
- {
- int n ;
- scanf("%d",&n) ;
- printf("%d\n",n);
- for(int i = ; i <= n ; i++)
- {
- int day,year ;
- char month[];
- scanf("%d",&day) ;
- getchar();
- cin>>month ;
- cin>>year ;
- int mon ;
- if(strcmp(month,"pop")==) mon = ;
- if(strcmp(month,"no")==) mon = ;
- if(strcmp(month,"zip")==) mon = ;
- if(strcmp(month,"zotz")==) mon = ;
- if(strcmp(month,"tzec")==) mon = ;
- if(strcmp(month,"xul")==) mon = ;
- if(strcmp(month,"yoxkin")==) mon = ;
- if(strcmp(month,"mol")==) mon = ;
- if(strcmp(month,"chen")==) mon = ;
- if(strcmp(month,"yax")==) mon = ;
- if(strcmp(month,"zac")==) mon = ;
- if(strcmp(month,"ceh")==) mon = ;
- if(strcmp(month,"mac")==) mon = ;
- if(strcmp(month,"kankin")==) mon = ;
- if(strcmp(month,"muan")==) mon = ;
- if(strcmp(month,"pax")==) mon = ;
- if(strcmp(month,"koyab")==) mon = ;
- if(strcmp(month,"cumhu")==) mon = ;
- if(strcmp(month,"uayet")==) mon = ;
- int days = (year*)+(mon-)*+day;
- printf("%d ",days%%+);
- int Tdays = days%%+ ;
- if(Tdays == ) cout<<"imix";
- if(Tdays == ) cout<<"ik";
- if(Tdays == ) cout<<"akbal";
- if(Tdays == ) cout<<"kan";
- if(Tdays == ) cout<<"chicchan";
- if(Tdays == ) cout<<"cimi";
- if(Tdays == ) cout<<"manik";
- if(Tdays == ) cout<<"lamat";
- if(Tdays == ) cout<<"muluk";
- if(Tdays == ) cout<<"ok";
- if(Tdays == ) cout<<"chuen";
- if(Tdays == ) cout<<"eb";
- if(Tdays == ) cout<<"ben";
- if(Tdays == ) cout<<"ix";
- if(Tdays == ) cout<<"mem";
- if(Tdays == ) cout<<"cib";
- if(Tdays == ) cout<<"caban";
- if(Tdays == ) cout<<"eznab";
- if(Tdays == ) cout<<"canac";
- if(Tdays == ) cout<<"ahau";
- //int Tyears = (year*365)/260 ;
- int Tyears = days/;
- cout<<" "<<Tyears<<endl ;
- }
- return ;
- }
POJ1008Maya Calendar的更多相关文章
- 北大ACM(POJ1008-Maya Calendar)
Question:http://poj.org/problem?id=1008 问题点:日历转换. Memory: 280K Time: 16MS Language: C++ Result: Acce ...
- poj 1008:Maya Calendar(模拟题,玛雅日历转换)
Maya Calendar Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 64795 Accepted: 19978 D ...
- Java 时间类-Calendar、Date、LocalDate/LocalTime
1.Date 类 java.util.Date是一个"万能接口",它包含日期.时间,还有毫秒数,如果你只想用java.util.Date存储日期,或者只存储时间,那么,只有你知道哪 ...
- Js: Extensible Calendar Examples
http://ext.ensible.comhttps://github.com/bmoeskau/Extensiblehttps://github.com/TeamupCom/extensibleh ...
- Calendar类
Calendar类 注意:根据日历规则,如果想要这个月减去5天,那么则为: add(Calendar.Day,-5) 成员方法: public int get(int field):返回给定日历段的值 ...
- This month Calendar
package fourth;import java.text.DateFormatSymbols;import java.util.*;public class CalendarTest { pub ...
- calendar的一些操作
一.通过分析日期函数,根据日期进行一系列操作,例如:我们需要知道2个时间段中所有的日期等等. 由于Calendar 类是一个抽象类,因此我们不能通过new来获取该对象的实例.我们可以通过其类方法 ge ...
- java-String Date Calendar之间的转换
1.Calendar 转化 String Calendar calendat = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDa ...
- jQuery Ion.Calendar 日期/日历
在线实例 实例演示 默认 实例演示 每周第一天 实例演示 输入框插件 实例演示 HTML data 属性 实例演示 回调函数1 实例演示 回调函数2 使用方法 <div id="cal ...
随机推荐
- 【风马一族_git_github】git的工作流程
git有三个区域(如图): 基本信息设置 1)设置用户名 git config --global user.name "帐号名" 2)设置用户名邮箱 git config ...
- arm汇编指令总结(不断更新)
/** ****************************************************************************** * @author Maox ...
- (转)HTML5游戏如何挣钱?2条经验让你每款赚3万刀
原文作者:Alexander Krug,是世界上最大的HTML5游戏平台的运营商SOFTGAMES的CEO. 现今苹果App Store当中的应用数量可以以海量来形容,最新发布的应用对排行榜的冲击力也 ...
- CDH JPS 出现没有名字的进程
jps 时出现没有名字的进程 或者process information unavailable 把服务关掉,执行一下 rm -rf /tmp/hsperfdata_* 再重启就好了.
- Jquery 在动态元素上绑定事件
弄了很久却没有弄出来,感觉没有错,但是动态元素上的事件根本就不响应,代码如下: <input type="button" id="btnyes" valu ...
- 表达式语言之EL表达式
1.EL的用法EL的起源:起源于JSTL.EL运算符: 算术型:+.-.*./.div.%.mod.其中/和div都表示求除.%和mod表示求余数. 逻辑型:and或&&.or或||. ...
- VC2010 MFC文档类菜单快捷键无法加载问题
问题1. 在菜单中项中输入&Run\tF5, 运行显示Run,而不是Run F5. 问题2.在Accelerator中绑定了快捷键,但运行程序不起作用. 以上2中问题在VC++2008和VC+ ...
- http概述
HTTP是一个属于应用层的面向对象的协议,由于其简捷.快速的方式,适用于分布式超媒体信息系统.它于1990年提出,经过几年的使用与发展,得到不断地完善和扩展.目前在WWW中使用的是HTTP/1.0的第 ...
- [转]- Winform 用子窗体刷新父窗体,子窗体改变父窗体控件的值
转自:http://heisetoufa.iteye.com/blog/382684 第一种方法: 用委托,Form2和Form3是同一组 Form2 using System; using Sys ...
- cocos2dx中加载图片资源的方法,和从内存中获取已经加载的图片资源的方法
游戏中通常需要将常用的资源如:声音,图片,plist文件,提前加载进内存,以加快游戏的流畅度 1.预加载声音: SimpleAudioEngine::getInstance()->preload ...