Codeforces Round #350 (Div. 2) A. Holidays 水题
A. Holidays
题目连接:
http://www.codeforces.com/contest/670/problem/A
Description
On the planet Mars a year lasts exactly n days (there are no leap years on Mars). But Martians have the same weeks as earthlings — 5 work days and then 2 days off. Your task is to determine the minimum possible and the maximum possible number of days off per year on Mars.
Input
The first line of the input contains a positive integer n (1 ≤ n ≤ 1 000 000) — the number of days in a year on Mars.
Output
Print two integers — the minimum possible and the maximum possible number of days off per year on Mars.
Sample Input
14
Sample Output
4 4
题意
一周5天工作,2天休息
现在有n天,但是你不知道第一天是星期几,问你最多放多少天,最少放多少天
题解:
n才1e6,所以直接莽一波就好啦~
其实直接数学也很简单,最多的,就是前面2天为寒假,最少的就是后两天了。
代码
#include<bits/stdc++.h>
using namespace std;
int n,mi=1e9,ma=0;
int main()
{
int n;scanf("%d",&n);
for(int i=0;i<7;i++)
{
int tmp=i,tmp2=0;
for(int j=0;j<n;j++)
{
if(tmp<2)tmp2++;
tmp=(tmp+1)%7;
}
mi=min(mi,tmp2);
ma=max(ma,tmp2);
}
cout<<mi<<" "<<ma<<endl;
}
Codeforces Round #350 (Div. 2) A. Holidays 水题的更多相关文章
- Codeforces Round #350 (Div. 2) C. Cinema 水题
C. Cinema 题目连接: http://www.codeforces.com/contest/670/problem/C Description Moscow is hosting a majo ...
- Codeforces Round #185 (Div. 2) B. Archer 水题
B. Archer Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/312/problem/B D ...
- Codeforces Round #360 (Div. 2) A. Opponents 水题
A. Opponents 题目连接: http://www.codeforces.com/contest/688/problem/A Description Arya has n opponents ...
- Codeforces Round #190 (Div. 2) 水果俩水题
后天考试,今天做题,我真佩服自己... 这次又只A俩水题... orz各路神犇... 话说这次模拟题挺多... 半个多小时把前面俩水题做完,然后卡C,和往常一样,题目看懂做不出来... A: 算是模拟 ...
- Codeforces Round #256 (Div. 2/A)/Codeforces448A_Rewards(水题)解题报告
对于这道水题本人觉得应该应用贪心算法来解这道题: 下面就贴出本人的代码吧: #include<cstdio> #include<iostream> using namespac ...
- Codeforces Round #340 (Div. 2) B. Chocolate 水题
B. Chocolate 题目连接: http://www.codeforces.com/contest/617/problem/D Descriptionww.co Bob loves everyt ...
- Codeforces Round #340 (Div. 2) A. Elephant 水题
A. Elephant 题目连接: http://www.codeforces.com/contest/617/problem/A Descriptionww.co An elephant decid ...
- Codeforces Round #340 (Div. 2) D. Polyline 水题
D. Polyline 题目连接: http://www.codeforces.com/contest/617/problem/D Descriptionww.co There are three p ...
- Codeforces Round #338 (Div. 2) A. Bulbs 水题
A. Bulbs 题目连接: http://www.codeforces.com/contest/615/problem/A Description Vasya wants to turn on Ch ...
随机推荐
- Ubuntu下安装arm-linux-gnueabi-xxx编译器【转】
转自:http://blog.csdn.net/real_myth/article/details/51481639 from: http://www.linuxdiyf.com/linux/1948 ...
- 002_安装第三方APP好的站点及解除安全与隐私限制
一.解除安全与隐私限制的任何来源. http://bbs.feng.com/read-htm-tid-10714286.html 接下来,我们就打开终端,然后输入以下命令: sudo spctl ...
- 1->小规模集群架构规划
"配置无人值守批量安装系统(Cobbler)" "搭建PPTP VPN/ NTP/Firewalld内部共享上网 " "搭建跳板机服务jumpserv ...
- Android调试大法 自定义IDE默认签名文件==>微信支付、微信登录、微信分享,debug时调试通过,release时调不起微信
转载地址:http://blog.yanzhenjie.com Android调试大法之自定义IDE默认签名文件,你是否为调试第三方SDK时debug签名和release签名发生冲突而烦恼?你是否在d ...
- Bootstrap FileInput 多图上传插件 文档属性说明
Bootstrap FileInput 多图上传插件 原文链接:http://blog.csdn.net/misterwho/article/details/72886248?utm_source ...
- 使用Dockerfile构建docker lnmp环境
一.mysql 1.创建 Dockerfile mkdir mysql # 创建一个目录存放之后的Dockerfile,目录名无所谓 cd mysql # 进入目录 vi Dockerfile # 创 ...
- HDU 3360 National Treasures(最小点覆盖)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3360 题目大意: 在一个n*m的格子中,每个格子有一个数值,-1表示空,其余表示财宝.每个财宝的数值转 ...
- kafka介绍与搭建(单机版)
一.kafka介绍 1.1 主要功能 根据官网的介绍,ApacheKafka®是一个分布式流媒体平台,它主要有3种功能: 1:It lets you publish and subscribe to ...
- 【51nod】1655 染色问题
题解 首先每个颜色出现的次数应该是一样的 \(\frac{C_{n}^{2}}{n} = \frac{n - 1}{2}\) 所以n如果是偶数那么就无解了 然后我们需要让每个点连颜色不同的四条边 只要 ...
- python根据字典自动生成一组省和市名
字典如下: dict={ '河北省':['石家庄','唐山','秦皇岛','承德'], '山东省':['济南','青岛','临沂','淄博'], '湖南省':['长沙','衡阳','湘潭','邵阳', ...