CodeForces 670 A. Holidays(模拟)
Description
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.
Sample Input
Input Output Input Output Hint
In the first sample there are days in a year on Mars, and therefore independently of the day a year starts with there will be exactly days off . In the second sample there are only days in a year on Mars, and they can both be either work days or days off.
题目链接:http://codeforces.com/problemset/problem/670/A
***********************************************
题意:一周5天工作,2天休息 。现在有n天,但是你不知道第一天是星期几,问你最多放多少天,最少放多少天
分析:简单模拟。
7天为一个周期,如果求放假天数最小的时候就看成 1 2 3 4 5 6 7,
如果求放假天数最大就看成 6 7 1 2 3 4 5。
AC代码:
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<queue>
#include<algorithm>
#include<time.h>
#include<stack>
using namespace std;
#define N 1200000
#define INF 0x3f3f3f3f int dp[N];
int a[N]; int main()
{
int n,l,r; while(scanf("%d", &n) != EOF)
{
if(n<)
r=n,l=;
else if(n<=)
r=,l=;
else if(n<=)
l=n-,r=;
else
{
if(n%<)
{
l=n/*;
r=n/*+n%;
}
else if(n%<=)
{
l=n/*;
r=n/*+;
}
else if(n%<)
{
l=n/*+n%-;
r=n/*+;
}
}
printf("%d %d\n",l,r);
}
return ;
}
CodeForces 670 A. Holidays(模拟)的更多相关文章
- Codeforces 670 - A/B/C/D/E/F - (Done)
链接:https://codeforces.com/contest/670 A - Holidays - [水] AC代码: #include<bits/stdc++.h> using n ...
- Codeforces 738D. Sea Battle 模拟
D. Sea Battle time limit per test: 1 second memory limit per test :256 megabytes input: standard inp ...
- Codeforces 626A Robot Sequence(模拟)
A. Robot Sequence time limit per test:2 seconds memory limit per test:256 megabytes input:standard i ...
- CodeForces - 589D(暴力+模拟)
题目链接:http://codeforces.com/problemset/problem/589/D 题目大意:给出n个人行走的开始时刻,开始时间和结束时间,求每个人分别能跟多少人相遇打招呼(每两人 ...
- Codeforces 767B. The Queue 模拟题
B. The Queue time limit per test:1 second memory limit per test:256 megabytes input:standard input o ...
- Codeforces 704A Thor 队列模拟
题目大意:托尔有一部手机可执行三种操作 1.x APP产生一个新消息 2.读取x App已产生的所有消息 3.读取前t个产生的消息 问每次操作后未读取的消息的数量 题目思路: 队列模拟,坑点在于竟然卡 ...
- Vasya And The Mushrooms CodeForces - 1016C (前缀和模拟)
大意: 给定2*n的矩阵, 每个格子有权值, 走到一个格子的贡献为之前走的步数*权值, 每个格子只能走一次, 求走完所有格子最大贡献. 沙茶模拟打了一个小时总算打出来了 #include <io ...
- Codeforces 691C. Exponential notation 模拟题
C. Exponential notation time limit per test: 2 seconds memory limit per test:256 megabytes input: st ...
- Codeforces 658A. Robbers' watch 模拟
A. Robbers' watch time limit per test: 2 seconds memory limit per test: 256 megabytes input: standar ...
随机推荐
- NOIP2001-普及组复赛-第二题-最大公约数和最小公倍数问题
题目描述 Description 输入二个正整数x0,y0(2<=x0<100000,2<=y0<=1000000),求出满足下列条件的P,Q的个数条件: 1.P,A是正整数 ...
- 【卷一】正则一 之re.split
有时候,用re.split()匹配字符串会比findall,search, match等 正则表达式对象方法方便简洁很多! 参考: <Python核心编程(3rd)>—p23 如果给定分隔 ...
- Scala Tuple类型
Tuple可以作为集合存储不同类型的数据,初始化实例如下: val tuple = (1,3,3.14,"aa") val third = tuple._3 Tuple 下标访问从 ...
- The Linux Storage Stack Diagram 内核 4.0 版的 I/O 栈
- 多态性Polymorphism
一.多态性的概念: 1.多态:在面向对象方法中一般是这样表述多态性的: 向不同的对象发送同一个消息,不同的对象在接收时会产生不同的行为(即方法).也可以说,多态性是“一个接口,多种方法”. 2.从 ...
- 2.Add Two Numbers-两个单链表相加
You are given two linked lists representing two non-negative numbers. The digits are stored in rever ...
- 【报错】java.lang.RuntimeException: Invalid action class configuration that references an unknown class named [xxxAction]
java.lang.RuntimeException: Invalid action class configuration that references an unknown class name ...
- Android任务栈TaskStack
Task:有多个Activity按顺序组成的一个完整的业务逻辑. 任务栈(TaskStack):新增的Activity放入栈中,点击back栈顶Activity从栈中退出. android:nohis ...
- python基础(三)列表、数组、字典
列表与元组 列表是最常用的数据类型之一,通过列表可以对数据实现最方便的存储.修改等操作 定义列表 1 >>> names = ['wangeq','zlx','jack','rose ...
- 如何查找僵尸进程并Kill之,杀不掉的要查看父进程并杀之
转自:如何查找僵尸进程并Kill之,杀不掉的要查看父进程并杀之 用ps和grep命令寻找僵尸进程#ps -A -ostat,ppid,pid,cmd | grep -e '^[Zz]'命令注解:-A ...