Codeforces Round #350 (Div. 2) A
1 second
256 megabytes
standard input
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.
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.
题意: 假设一年有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>=)
{
s1=(n/)*;
if(n%==)
s1+=;
}
else
{
if(n==)
s1=;
else
s1=;
}
int s2=;
if(n->=)
{
s2+=((n-)/*);
if((n-)%==)
s2+=;
}
else
{
if(n-==)
s2+=;
else
s2+=;
}
if(n>)
printf("%d %d\n",s1,s2);
if(n==)
printf("0 1\n");
if(n==)
printf("0 2\n");
}
return ;
}
Codeforces Round #350 (Div. 2) A的更多相关文章
- Codeforces Round #350 (Div. 2) E. Correct Bracket Sequence Editor 模拟
题目链接: http://codeforces.com/contest/670/problem/E 题解: 用STL的list和stack模拟的,没想到跑的还挺快. 代码: #include<i ...
- Codeforces Round #350 (Div. 2) D2. Magic Powder - 2
题目链接: http://codeforces.com/contest/670/problem/D2 题解: 二分答案. #include<iostream> #include<cs ...
- Codeforces Round #350 (Div. 2) E. Correct Bracket Sequence Editor (链表)
题目链接:http://codeforces.com/contest/670/problem/E 给你n长度的括号字符,m个操作,光标初始位置是p,'D'操作表示删除当前光标所在的字符对应的括号字符以 ...
- Codeforces Round #350 (Div. 2)解题报告
codeforces 670A. Holidays 题目链接: http://codeforces.com/contest/670/problem/A 题意: A. Holidays On the p ...
- Codeforces Round #350 (Div. 2) E. Correct Bracket Sequence Editor 栈 链表
E. Correct Bracket Sequence Editor 题目连接: http://www.codeforces.com/contest/670/problem/E Description ...
- Codeforces Round #350 (Div. 2) D1. Magic Powder - 1 二分
D1. Magic Powder - 1 题目连接: http://www.codeforces.com/contest/670/problem/D1 Description This problem ...
- Codeforces Round #350 (Div. 2) C. Cinema 水题
C. Cinema 题目连接: http://www.codeforces.com/contest/670/problem/C Description Moscow is hosting a majo ...
- Codeforces Round #350 (Div. 2) B. Game of Robots 水题
B. Game of Robots 题目连接: http://www.codeforces.com/contest/670/problem/B Description In late autumn e ...
- Codeforces Round #350 (Div. 2) A. Holidays 水题
A. Holidays 题目连接: http://www.codeforces.com/contest/670/problem/A Description On the planet Mars a y ...
- Codeforces Round #350 (Div. 2) E 思维模拟
给出一个合法的括号串 有LRD三种操作 LR分别是左右移动当前位置 且合法 D为删除这个括号和里面的所有 当删除完成后 位置向右移动 如果不能移动 就向左 比赛都是很久远的事情了 写这道题也是一时兴起 ...
随机推荐
- 8.2 USB键盘驱动编写和测试
目标:根据USB驱动分析和上节的USB鼠标驱动,编写键盘驱动,并测试. 一.原理分析 1. 首先通过打印usb_buf[i]中的8字节数据,看一下按键按下之后会接收到什么. 1)通过按完所有键盘按键打 ...
- 20190105-打印字母C,H,N,口等图像和杨辉三角
1. 打印字母C ****** * * * * ****** def print_c(n): print('*' * n) for i in range(n): print('* ') print(' ...
- scrapy框架爬取笔趣阁完整版
继续上一篇,这一次的爬取了小说内容 pipelines.py import csv class ScrapytestPipeline(object): # 爬虫文件中提取数据的方法每yield一次it ...
- python2.7练习小例子(七)
7):题目:将一个列表的数据复制到另一个列表中. 程序分析:使用列表[:]. 程序源代码: #!/usr/bin/python # -*- coding: UTF-8 -*- ...
- 做模态弹框的时候,防止背景滚动方法 移动端 html5
$(window.document).bind("touchmove", function() { return false; });
- Linux下创建pycharm的快捷方式
第一步:创建桌面快捷方式文件Pycharm.desktop,并打开 sudo gedit /usr/share/applications/Pycharm.desktop 第二步:在打开的文件Pycha ...
- Linux-Shell脚本编程-学习-8-函数
在这章往后的学习中,我讲尽可能详细的讲书中讲到的都记录到这里,以便以后方便查看. 什么是函数,函数就是一段代码,这段代码可以在我们需要的位置调用,那么这段代码就叫做函数. 在Shell中,定义一个函数 ...
- 自动化测试-selenium启动浏览器
在自动化测试过程中,通过selenium启动浏览器时,可能需要加载插件(如测试用的firebug.或产品中要求必须添加某插件等).读取用户数据(自己浏览器的配置文件/别人直接给的浏览器配置文件).设置 ...
- 自动化测试学习之路--java String、StringBuilder
Java中的String和StringBuilder类: 1.String对象是不可变的.每一个看起来修改了String值的方法,实际上都是创建了全新的String对象.代码示例如下: String ...
- Leetcode. 回文字符串的分割和最少分割数
Q1: 回文字符串的分割 Given a string s, partition s such that every substring of the partition is a palindrom ...