A. Holidays
来源:互联网 发布:淘宝多琳香水是正品么 编辑:程序博客网 时间:2024/05/16 12:44
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.
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.
Print two integers — the minimum possible and the maximum possible number of days off per year on Mars.
14
4 4
2
0 2
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;}
- A. Holidays
- codeforces 670A Holidays
- codeforce 350 A. Holidays
- CodeForces 670A Holidays
- 【codeforces】-#670A- Holidays
- 【CodeForces】670A - Holidays
- CodeForces 670A Holidays
- codeforces 670A Holidays
- Holidays
- Holidays
- CodeForces 670A Holidays(水题)
- CodeForces - 670A Holidays (模拟) 水
- CodeForces 670A Holidays 火星人的假期
- 【CodeForces】670A - Holidays(数学)
- 【CodeForces 670A】Holidays(水题)
- Have a smile my friends, Enjoy your Christmas holidays.
- Codeforces Round#350(Div. 2) 670A Holidays
- My holidays
- java 回调
- 模拟实现strrchr,strchr
- USCoj 1396- Select Team 状压DP
- __typeof在Xcode7中的使用
- int 等数据类型的含义
- A. Holidays
- 推荐几个常用的Git代码托管平台
- 机器学习简介
- 【会议】QCon2016会议整理(一)——工程效率与架构
- Problem3-1001
- Android源码浅析(二)——Ubuntu Root,Git,VMware Tools,安装输入法,主题美化,Dock,安装JDK和配置环境
- LeetCode---Reverse String解题分析
- 【U3D】后期渲染性能优化之---减少Draw Calls的调用
- 模拟实训strstr,strrstr