【CodeForces】670A - Holidays(数学)

来源:互联网 发布:微型网络摄像机 编辑:程序博客网 时间:2024/06/05 18:49

题目链接:点击打开题目

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 4days 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.



挺水的数学题,注意1的特判就行了。

代码如下:

#include <cstdio>int main(){int n;while (~scanf ("%d",&n)){if (n == 1){printf ("0 1\n");continue;}if (n % 7 <= 5)printf ("%d ",n/7*2);elseprintf ("%d ",n/7*2+1);n -= 2;if (n % 7 <= 5)printf ("%d\n",n/7*2+2);elseprintf ("%d\n",n/7*2+1+2);}return 0;}


0 0