Codeforces Round #350 (Div. 2) A
1 second
256 megabytes
standard input
standard output
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.
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.
Print two integers — the minimum possible and the maximum possible number of days off per year on Mars.
14
4 4
2
0 2
In the first sample there are 14 days in a year on Mars, and therefore independently of the day a year starts with there will be exactly 4 days off .
In the second sample there are only 2 days in a year on Mars, and they can both be either work days or days off.
题意: 假设一年有n天 问一年内的休息天的数量(一周7天 5+2) 的最小值与最大值
题解:最小值---从周一开始算
最大值---从周六开始算
比赛的时候这题都gg了 没处理好 菜
#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<queue>
#include<stack>
#include<map>
#define ll __int64
#define pi acos(-1.0)
using namespace std;
int n;
int main()
{
while(scanf("%d",&n)!=EOF)
{
int s1;
if(n>=)
{
s1=(n/)*;
if(n%==)
s1+=;
}
else
{
if(n==)
s1=;
else
s1=;
}
int s2=;
if(n->=)
{
s2+=((n-)/*);
if((n-)%==)
s2+=;
}
else
{
if(n-==)
s2+=;
else
s2+=;
}
if(n>)
printf("%d %d\n",s1,s2);
if(n==)
printf("0 1\n");
if(n==)
printf("0 2\n");
}
return ;
}
Codeforces Round #350 (Div. 2) A的更多相关文章
- Codeforces Round #350 (Div. 2) E. Correct Bracket Sequence Editor 模拟
题目链接: http://codeforces.com/contest/670/problem/E 题解: 用STL的list和stack模拟的,没想到跑的还挺快. 代码: #include<i ...
- Codeforces Round #350 (Div. 2) D2. Magic Powder - 2
题目链接: http://codeforces.com/contest/670/problem/D2 题解: 二分答案. #include<iostream> #include<cs ...
- Codeforces Round #350 (Div. 2) E. Correct Bracket Sequence Editor (链表)
题目链接:http://codeforces.com/contest/670/problem/E 给你n长度的括号字符,m个操作,光标初始位置是p,'D'操作表示删除当前光标所在的字符对应的括号字符以 ...
- Codeforces Round #350 (Div. 2)解题报告
codeforces 670A. Holidays 题目链接: http://codeforces.com/contest/670/problem/A 题意: A. Holidays On the p ...
- Codeforces Round #350 (Div. 2) E. Correct Bracket Sequence Editor 栈 链表
E. Correct Bracket Sequence Editor 题目连接: http://www.codeforces.com/contest/670/problem/E Description ...
- Codeforces Round #350 (Div. 2) D1. Magic Powder - 1 二分
D1. Magic Powder - 1 题目连接: http://www.codeforces.com/contest/670/problem/D1 Description This problem ...
- 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 #350 (Div. 2) B. Game of Robots 水题
B. Game of Robots 题目连接: http://www.codeforces.com/contest/670/problem/B Description In late autumn e ...
- Codeforces Round #350 (Div. 2) A. Holidays 水题
A. Holidays 题目连接: http://www.codeforces.com/contest/670/problem/A Description On the planet Mars a y ...
- Codeforces Round #350 (Div. 2) E 思维模拟
给出一个合法的括号串 有LRD三种操作 LR分别是左右移动当前位置 且合法 D为删除这个括号和里面的所有 当删除完成后 位置向右移动 如果不能移动 就向左 比赛都是很久远的事情了 写这道题也是一时兴起 ...
随机推荐
- 2.5 进程控制之wait函数
一.绪论 一个进程在终止时会关闭所有文件描述符,释放在用户空间分配的内存,但它的PCB还保留着,内核在其中保存了一些信息:如果 是正常终止则保存着退出状态,如果是异常终止则保存着导致该进程终止的信号是 ...
- Waterline从概念到实操
Waterline基本介绍 Waterline是什么 Waterline是下一代存储和检索引擎,也是Sails框架中使用的默认ORM . ORM的基本概念 Object Relational Mapp ...
- Python自动化运维——文件与目录差异对比
Infi-chu: http://www.cnblogs.com/Infi-chu/ 模块:filecmp 安装:Python版本大于等于2.3默认自带 功能:实现文件.目录.遍历子目录的差异 常用方 ...
- POJ1426 Find The Multiple 解题报告
参考:http://www.cnblogs.com/ACShiryu/archive/2011/07/24/2115356.html #include <iostream> #includ ...
- 20145202马超《网络对抗》Exp3免杀 进阶
木马化正常软件,如通过改变机器指令.实现可免杀免防火墙提示的后门. 继上次实验3所做的代码在主函数里面加上一行调用就可以 改各种属性,这里我参考了郝浩同学的博客 最后我还是遇到了问题 后来发现虽然有那 ...
- vs编译报错 BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
1.重复释放内存导致,new delete和malloc free两个组合分配的堆空间都不能重复释放两次: 2.用delete或者free释放栈空间导致内存空间被破坏(栈空间内存的头部有系统写入的一些 ...
- C# 获取当前日期当年的周数
这几天跨年,项目上遇到了一个周数计算的问题. 2016年的元旦是周五开始的,之前系统计算的是属于15年的第53个周,但是年份已经到了16年了. 公司要求从1月1号周五开始算作16年的第一个周,今天1月 ...
- quartz 使用总结
quartz是一个任务调度框架,具体的用途比如说,我想我的程序在每天的3点干什么事,每隔多长时间做一件什么事.quartz框架就可以完美地解决这些. 1.xml配置方式 首先我是用spring来管理的 ...
- i8浏览器不支持placeholder属性解决办法,以及解决后,文字不居中问题
这里想实现的效果是:设置和移除文本框默认值,如下图鼠标放到文本框中的时候,灰字消失. 1.可以用简单的方式,就是给input文本框加上onfocus属性,如下代码: <input id=&quo ...
- Spark性能超过Hadoop百倍
Spark在偷换概念,Hadoop跑硬盘,Spark跑内存,地球人都知道,内存的速度可是远超硬盘一个量级,超过100倍又有什么奇怪的.如果要比,咱们都拿硬盘来跑跑看!