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
Input Output Input Output Hint
In the first sample there are days in a year on Mars, and therefore independently of the day a year starts with there will be exactly days off . In the second sample there are only days in a year on Mars, and they can both be either work days or days off.

题目链接:http://codeforces.com/problemset/problem/670/A

***********************************************

题意:一周5天工作,2天休息 。现在有n天,但是你不知道第一天是星期几,问你最多放多少天,最少放多少天

分析:简单模拟。

7天为一个周期,如果求放假天数最小的时候就看成 1 2 3 4 5 6 7,

如果求放假天数最大就看成 6 7 1 2 3 4 5。

AC代码:

 #include<stdio.h>
#include<string.h>
#include<math.h>
#include<queue>
#include<algorithm>
#include<time.h>
#include<stack>
using namespace std;
#define N 1200000
#define INF 0x3f3f3f3f int dp[N];
int a[N]; int main()
{
int n,l,r; while(scanf("%d", &n) != EOF)
{
if(n<)
r=n,l=;
else if(n<=)
r=,l=;
else if(n<=)
l=n-,r=;
else
{
if(n%<)
{
l=n/*;
r=n/*+n%;
}
else if(n%<=)
{
l=n/*;
r=n/*+;
}
else if(n%<)
{
l=n/*+n%-;
r=n/*+;
}
}
printf("%d %d\n",l,r);
}
return ;
}

CodeForces 670 A. Holidays(模拟)的更多相关文章

  1. Codeforces 670 - A/B/C/D/E/F - (Done)

    链接:https://codeforces.com/contest/670 A - Holidays - [水] AC代码: #include<bits/stdc++.h> using n ...

  2. Codeforces 738D. Sea Battle 模拟

    D. Sea Battle time limit per test: 1 second memory limit per test :256 megabytes input: standard inp ...

  3. Codeforces 626A Robot Sequence(模拟)

    A. Robot Sequence time limit per test:2 seconds memory limit per test:256 megabytes input:standard i ...

  4. CodeForces - 589D(暴力+模拟)

    题目链接:http://codeforces.com/problemset/problem/589/D 题目大意:给出n个人行走的开始时刻,开始时间和结束时间,求每个人分别能跟多少人相遇打招呼(每两人 ...

  5. Codeforces 767B. The Queue 模拟题

    B. The Queue time limit per test:1 second memory limit per test:256 megabytes input:standard input o ...

  6. Codeforces 704A Thor 队列模拟

    题目大意:托尔有一部手机可执行三种操作 1.x APP产生一个新消息 2.读取x App已产生的所有消息 3.读取前t个产生的消息 问每次操作后未读取的消息的数量 题目思路: 队列模拟,坑点在于竟然卡 ...

  7. Vasya And The Mushrooms CodeForces - 1016C (前缀和模拟)

    大意: 给定2*n的矩阵, 每个格子有权值, 走到一个格子的贡献为之前走的步数*权值, 每个格子只能走一次, 求走完所有格子最大贡献. 沙茶模拟打了一个小时总算打出来了 #include <io ...

  8. Codeforces 691C. Exponential notation 模拟题

    C. Exponential notation time limit per test: 2 seconds memory limit per test:256 megabytes input: st ...

  9. Codeforces 658A. Robbers' watch 模拟

    A. Robbers' watch time limit per test: 2 seconds memory limit per test: 256 megabytes input: standar ...

随机推荐

  1. MC- 交易并设置止损

    using System; using System.Drawing; using System.Linq; using PowerLanguage.Function; using ATCenterP ...

  2. SQL_where条件的优化

    原则,多数数据库都是从 左到右的顺序处理条件,把能过滤更多数据的条件放在前面,过滤少的条件放后面 SQL1: select * from employee             where sala ...

  3. SharePoint 入门书籍推荐 转载来源http://www.cnblogs.com/jianyus/p/3513238.html

    最近,总有人说刚入门SharePoint,没有好的资料或者电子书,资料推荐大家多看看博客园和CSDN的博客.对于看博客,我一般是两个思路,要么找一个人的从头到尾看一遍,觉得有意义的,就把地址加收藏:或 ...

  4. 微信账号 echo_server 的实现

    <?php/** 微信账号 echo_server 的实现*//** 定义 echo_server 的 TOKEN 为 echo_server*/define("TOKEN" ...

  5. JPA 系列教程11-复合主键-2个@Id

    复合主键 指多个主键联合形成一个主键组合 需求产生 比如航线一般是由出发地及目的地确定,如果要确定唯一的航线就可以用出发地和目的地一起来表示 ddl语句 CREATE TABLE `t_airline ...

  6. 10- python 网络爬虫分析

    Python 网络爬虫简单分析 import urllib2 response = urllib2.urlopen("http://www.baidu.com") print re ...

  7. Java语言进阶过程(转)

    [以下肯定是不完整的列表,欢迎补充] Java是一个通用的编程语言,其实可以干很多事,怎么学Java就看怎么用了. 但有一些一般的步骤: 1. 熟悉一种文本编辑器,比如Vim, Emacs, Note ...

  8. 2012-11-17 12:28 用MFC实现的计算器(详细版)

    这篇文章里通过计算器的简单实现,让大家能够了解一般对话框应用程序开发的基本流程 要求:编写简单的计算器应用程序,要求利用按钮进行加.减.乘,除操作,在对话框输出计算机结果. 下面结合操作步骤,讲解对话 ...

  9. javascript中的throttle和debounce

    throttle 我们这里说的throttle就是函数节流的意思.再说的通俗一点就是函数调用的频度控制器,是连续执行时间间隔控制.主要应用的场景比如: 1.鼠标移动,mousemove 事件2.DOM ...

  10. how to stop a thread

    it seems all stop methods of thread have been deprecated by java. so how to stop a thread then? it i ...