CodeForces760A
A. Petr and a calendar
Petr wants to make a calendar for current month. For this purpose he draws a table in which columns correspond to weeks (a week is seven consequent days from Monday to Sunday), rows correspond to weekdays, and cells contain dates. For example, a calendar for January 2017 should look like on the picture:

Petr wants to know how many columns his table should have given the month and the weekday of the first date of that month? Assume that the year is non-leap.
Input
The only line contain two integers m and d (1 ≤ m ≤ 12, 1 ≤ d ≤ 7) — the number of month (January is the first month, December is the twelfth) and the weekday of the first date of this month (1 is Monday, 7 is Sunday).
Output
Print single integer: the number of columns the table should have.
Examples
input
1 7
output
6
input
1 1
output
5
input
11 6
output
5
Note
The first example corresponds to the January 2017 shown on the picture in the statements.
In the second example 1-st January is Monday, so the whole month fits into 5 columns.
In the third example 1-st November is Saturday and 5 columns is enough.
//2017.01.31
#include <iostream>
#include <cstdio>
#include <cstring> using namespace std; int mouth[] = {, , , , , , , , , , , , }; int main()
{
int m, d;
while(cin>>m>>d)
{
int ans = (mouth[m]-(-d+)-)/++;
cout<<ans<<endl;
} return ;
}
CodeForces760A的更多相关文章
随机推荐
- Java并发编程之final域的内存语义
一.final域的重排序规则 对于final域,编译器和处理器要遵循两个重拍序规则: 1.在构造函数内对一个final域的写入,与随后把这个被构造对象的引用赋值给一个引用变量,这两个操作之间不能重排序 ...
- [微信小程序]——bug记录
记录日常开发小程序遇到的一些小问题: input 输入框(unfixed) 描述:输入框focus的时候,placeholder会往上面跳动一下 当 scroll-view 遇上 fixed 描述:给 ...
- centos6创建用户,设置ssh登录
创建用户 #创建用户 useradd -s /sbin/nologin mysql useradd –d /usr/china -m china #设置密码 passwd mysql passwd c ...
- java修改AD域用户密码使用SSL连接方式
正常情况下,JAVA修改AD域用户属性,只能修改一些普通属性, 如果要修改AD域用户密码和userAccountControl属性就得使用SSL连接的方式修改, SSL连接的方式需要操作以下步骤: 1 ...
- C# 对象相等性判断和同一性判断
在日常开发中经常需要编写代码比较不同的对象.例如,有时需要将对象都放到一个集合中,并编写代码对集合中的对象进行排序.搜索或者比较. System.Object类有两个Equals方法,如下: 1.实例 ...
- scala combineByKey用法说明
语法是: combineByKey[C]( createCombiner: V => C, mergeValue: (C, V) => C, mergeCombiners: ( ...
- Php开发银行接口之浦发银行
Php开发银行接口之浦发银行 (提示:下面的经验都是按照开发文档一步一步踩坑过来的,但是不能不看开发文档!!!) 第一步:开发准备 1,安装java,百度下载JDK很方便(我自己网盘有,然后配置环境变 ...
- IntelliJ IDEA(Community版本)的下载、安装和WordCount的初步使用(本地模式和集群模式)
不多说,直接上干货! 对于初学者来说,建议你先玩玩这个免费的社区版,但是,一段时间,还是去玩专业版吧,这个很简单哈,学聪明点,去搞到途径激活!可以看我的博客. 包括: IntelliJ IDEA(Co ...
- Python -- 网络编程 -- 抓取网页图片 -- 豆瓣妹子
首先分析页面URL,形如http://dbmeizi.com/category/[1-14]?p=[0-476] 图片种类对应编号: 1:'性感', 2:'有沟', 3:'美腿', 4:'小露点', ...
- C51单片机中data、idata、xdata、pdata的区别
C51单片机中data.idata.xdata.pdata的区别 data: 固定指前面0x00-0x7f的128个RAM,可以用acc直接读写的,速度最快,生成的代码也最小. idata: 固定指前 ...