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
Output
Input
Output
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了 没处理好 菜
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; }
相关文章推荐
- HTTP协议介绍
- 深度学习与meanshift结合实现跟踪
- Eclipse批量修改包名
- Oracle创建表空间、创建用户以及授权、查看权限
- spring boot 连接池配置
- iOS多线程(2)基本使用
- Mac配置maven环境
- CME-M5系列(三)——Primace下载安装
- 1043,输出PATest,PAT
- spring applicationContext.xml配置
- 小白说编译原理-5-变量支持计算器
- Docker实现跨主机容器实例网络通信(2)——利用OpenVSwitch构建多主机Docker网络
- navicat连接mysql
- 进程控制exec函数族
- GlobalSign 多域型(SNAs) SSL 证书
- 进制转换心得
- 第九周-实践项目
- JBoss最大连接数
- 查看Linux系统信息命令
- weblogic10上部署Hibernate应用的冲突解决方法