A. Holidays

来源:互联网 发布:淘宝多琳香水是正品么 编辑:程序博客网 时间:2024/05/16 12:44

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.


解题说明:此题是一道数学题,首先判断有多少个星期,然后根据多余的天数判断周末的数目。


#include<cstdio>#include <cstring>#include<cmath>#include<iostream>#include<algorithm>#include<vector>#include <map>using namespace std;int main(){int n,min,max,w;scanf("%d",&n);w=n/7;min=w*2;if(n%7 == 6){min++;}if(n%7 == 0){max=min;}else if(n%7==1){max=w*2 + 1;}else{max=w*2 + 2;}printf("%d %d\n",min,max);return 0;}


0 0
原创粉丝点击