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 ...
随机推荐
- 读书笔记 effective c++ Item 28 不要返回指向对象内部数据(internals)的句柄(handles)
假设你正在操作一个Rectangle类.每个矩形可以通过左上角的点和右下角的点来表示.为了保证一个Rectangle对象尽可能小,你可能决定不把定义矩形范围的点存储在Rectangle类中,而是把它放 ...
- 华夏部分互联网科技公司创始及IPO信息
时间:2018-04-19 前面整理了一些美国科技公司的信息,这篇文章整理的是我华夏的一些科技公司的信息. 华为.百度.阿里.腾讯.美团.携程.京东.小米.奇虎360……之后,其它一些公司,要么体量 ...
- Kubernetes 概述和搭建(多节点)
一.Kubernetes整体概述和架构 Kubernetes是什么 Kubernetes是一个轻便的和可扩展的开源平台,用于管理容器化应用和服务.通过Kubernetes能够进行应用的自动化部署和扩缩 ...
- MySQL学习笔记:生成一个时间序列
今天遇到一个需求是生成以下表格的数据,一整天24小时,每秒一行数据. 寻找颇旧,找到另外两个实现的例子,暂且学习一翻.另一个见另外一篇. DAY) AS DATE FROM ( ) AS tmp, ( ...
- python2.7
python2.7支持win32.win64 下载地址:http://pan.baidu.com/s/1dE39eQ9 初学,附一个牛人的python教程地址:http://www.liaoxuefe ...
- peda的官方文档说明
peda在github上的官方文档,摘抄过来,方便查阅. 安装 git clone https://github.com/longld/peda.git ~/peda echo "sourc ...
- **PHP错误Cannot use object of type stdClass as array in错误的
错误:将PHP对象类型当做了PHP数组 解决方法:用对象操作符-> 今天在PHP输出一个二维数组的时候,出现了“Fatal error: Cannot use object of type s ...
- C#重写ToString
C# 中的每个类或结构都可隐式继承 <xref:System.Object> 类. 因此,C# 中的每个对象都会获取 <xref:System.Object.ToString%2A& ...
- spark java API 实现二次排序
package com.spark.sort; import java.io.Serializable; import scala.math.Ordered; public class SecondS ...
- codis+redis集群学习整理(待续)
Codis 由四部分组成: Codis Proxy (codis-proxy) Codis Manager (codis-config) Codis Redis (codis-server) ZooK ...