CodeForces 670 A. Holidays(模拟)

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 716A Crazy Computer 【模拟】 (Codeforces Round #372 (Div. 2))


下一篇:python-爬虫-Beautifulsoup模块