您的位置:首页 > 其它

Codeforces Round #350 (Div. 2) A

2016-05-06 09:27 411 查看
A. Holidays

time limit per test
1 second

memory limit per test
256 megabytes

input
standard input

output
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.

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.

Examples

Input
14


Output
4 4


Input
2


Output
0 2


Note
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>=7)
{
s1=(n/7)*2;
if(n%7==6)
s1+=1;
}
else
{
if(n==6)
s1=1;
else
s1=0;
}
int s2=2;
if(n-2>=7)
{
s2+=((n-2)/7*2);
if((n-2)%7==6)
s2+=1;
}
else
{
if(n-2==6)
s2+=1;
else
s2+=0;
}
if(n>2)
printf("%d %d\n",s1,s2);
if(n==1)
printf("0 1\n");
if(n==2)
printf("0 2\n");
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: