CF760A Petr and a calendar 题解】的更多相关文章

Content 输入两个数 \(m,d\),请输出 \(2017\) 年 \(m\) 月的日历[其中第一天是星期 \(d\)(如果 \(d=7\) 就是星期天)]需要印的列数. 格式见题目所述. 数据范围:\(1\leqslant m\leqslant 12,1\leqslant d\leqslant 7\). Solution 你们怎么都这么麻烦啊,什么循环啊,什么讨论 \(4,5,6\) 啊,这题目不很简单就完事了吗? 首先我们可以看到,这里不需要考虑闰年,所以,我们把所有月份的天数通通用一…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output 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 consequ…
题目链接:http://codeforces.com/problemset/problem/760/A 题意:日历需要多少列. #include <bits/stdc++.h> using namespace std; ] = {,,,,,,,,,,,}; int main() { int m,d; scanf("%d%d",&m,&d); ]; ; day = day - (-d+); ) ans+=(day/+); ); printf("%d\…
A. Petr and a calendar time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Petr wants to make a calendar for current month. For this purpose he draws a table in which columns correspond to wee…
A. Petr and a calendar time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Petr wants to make a calendar for current month. For this purpose he draws a table in which columns correspond to wee…
A. Petr and a calendar time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Petr wants to make a calendar for current month. For this purpose he draws a table in which columns correspond to wee…
Content 有一个锁,它只有指针再次指到 \(0\) 刻度处才可以开锁(起始状态如图所示,一圈 \(360\) 度). 以下给出 \(n\) 个操作及每次转动度数,如果可以通过逆时针或顺时针再次转到 \(0\) 度输出 YES,否则输出 NO. 数据范围:\(1\leqslant n\leqslant 15\),\(1\leqslant a_i\leqslant 180\). Solution 不知道为什么 19 年 4 月就做了这题,现在看到这题想写篇题解,于是就有了这篇题解( 我们一看到…
题目描述 MyCalendar主要实现一个功能就是插入指定起始结束时间的事件,对于重合的次数有要求. MyCalendar I要求任意两个事件不能有重叠的部分,如果插入这个事件会导致重合,则插入失败,不进行插入:否则插入并返回true. My Calendar II要求任意三个事件不能有重叠的部分,但是两个事件可以有重叠.同样是成功返回true,失败返回false. My Calendar III没有要求,对于每次插入新事件,求当前总体最大的重叠事件的个数. MyCalendar I 对于不能重…
题意:r*c方格中,每个格子有一定石子,每次移动每格任意数量石子,只能向下或者向右动一格,不能移动为败 思路:显然是Nim,到右下曼哈顿距离为偶数的不用管,因为先手动一下后手动一下最后移到右下后还是先手的回合:奇数移动一格必到偶数格,所以奇数的Nim一下.很简单的入门题. 代码: #include<set> #include<map> #include<stack> #include<cmath> #include<queue> #include…
Content 小 P 有一本 \(n\) 页的书,现给出他一周七天每天的阅读页数,求它在星期几读完这本书. 数据范围:\(1\leqslant n\leqslant 1000\). Solution 由于数据范围很小,所以我们尝试直接模拟,每一天读完减去当天读的页数,直到剩余页数小于等于 \(0\) 为止,此时的星期数就是我们要求的了. Code #include <cstdio> #include <algorithm> #include <cmath> #incl…