【CodeForces】670A - Holidays(数学)
来源:互联网 发布:微型网络摄像机 编辑:程序博客网 时间:2024/06/05 18:49
题目链接:点击打开题目
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 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;}
- 【CodeForces】670A - Holidays(数学)
- codeforces 670A Holidays
- CodeForces 670A Holidays
- 【codeforces】-#670A- Holidays
- 【CodeForces】670A - Holidays
- CodeForces 670A Holidays
- codeforces 670A Holidays
- CodeForces 670A Holidays(水题)
- 【CodeForces 670A】Holidays(水题)
- CodeForces - 670A Holidays (模拟) 水
- CodeForces 670A Holidays 火星人的假期
- Codeforces Round#350(Div. 2) 670A Holidays
- A. Holidays
- codeforces 789A(数学)
- CodeForces - 44C Holidays
- codeforce 350 A. Holidays
- CodeForces 453A(数学期望)
- Educational Codeforces Round 7(A)数学
- 顺时针打印矩阵
- C++实验6
- 深入浅出 - Android系统移植与平台开发(四)- Android启动流程
- VS中使用Entity Framework连接Mysql,添加Entity Data Model时向导闪退解决方案
- c语言学习笔记16之字符串常用函数
- 【CodeForces】670A - Holidays(数学)
- 欢迎使用CSDN-markdown编辑器
- oracle启动参数文件顺序解释
- Java读写文件的几种方法
- weiphp入门小结
- nodejs安装
- Spark-1.6.0中的Sort Based Shuffle源码解读
- LINUX下mysql区分大小写的问题
- 长期接受碎片化信息,会有什么后果?