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. $each $position $sort $slice

    $push 向数组中添加元素 $each 循环数据(循环添加数据到数组) $sort 对数组进行排序(1:升序:-1:降序.) $slice 对整个collection表进行数据裁减,用的时候一定要当 ...

  2. 。◕‿◕。TMD

    。◕‿◕。TMD TimeLimit: 2000/1000 MS (Java/Others)  MenoryLimit: 32768/32768 K (Java/Others) 64-bit inte ...

  3. sublime 配置 python IDE

    安装sublime下载地址:http://www.sublimetext.com/,请自行根据系统版本进行下载.下载好之后直接安装即可. 汉化包 汉化包下载: 汉化方法: 1.运行sublime te ...

  4. MS13-069(CVE-2013-3205) CCaret use-after-free Vulnerability Analysis (2014.9)

    MS13-069(CVE-2013-3205) CCaret use-after-free Vulnerability Analysis 1. Introduction In IE's standar ...

  5. 执行 npm run update-webdriver 提示文件不能获取错误

    按照angularjs官网的入门教程中输入 npm run update-webdriver  总是提示 https://chromedriver.storage.googleapis.com/2.1 ...

  6. jquery 1.9版本后不在支持browser 方法的解决方案

    今天对jquery 进行升级,导致项目出错,原来在1.9版本之后 jquery 不支持browser 方法了.  官方建议的又不好用,所以我所jquery 原来的代码摘除来,又扩展回去. //解决jq ...

  7. linux设置时间服务器

    对多个linux服务器,时间保持一致是很必要的.根据精确度要求,应该有相应的时间间隔进行时间同步.如果不进行时间同步,时间久了就会差别很大,遇到问题时定位就很困难.因为多台设备的配合,log之间可能有 ...

  8. Kubernetes 1.5.1 部署

    > kubernetes 1.5.0 , 配置文档 # 1 初始化环境 ## 1.1 环境: | 节 点  |      I P      ||--------|-------------||n ...

  9. 让AutoMapper在你的项目里飞一会儿(转)

    出处:http://www.cnblogs.com/WeiGe/p/3835523.html 先说说DTO DTO是个什么东东? DTO(Data Transfer Object)就是数据传输对象,说 ...

  10. Linux(centos5.0+)unison+inotify-tools触发式双向自动同步

    192.168.1.11是server1, 192.168.1.22是server2. [1]安装inotify-tools   各大linux发行版本都有inotify-tools软件包,建议通过y ...