Codeforces 842A Kirill And The Game【暴力,水】
A. Kirill And The Game
Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characterized by two integers — amount of experience and cost. The efficiency of a potion is the ratio of the amount of experience to the cost. Efficiency may be a non-integer number.
For each two integer numbers a and b such that l ≤ a ≤ r and x ≤ b ≤ y there is a potion with experience a and cost b in the store (that is, there are (r - l + 1)·(y - x + 1) potions).
Kirill wants to buy a potion which has efficiency k. Will he be able to do this?
First string contains five integer numbers l, r, x, y, k (1 ≤ l ≤ r ≤ 107, 1 ≤ x ≤ y ≤ 107, 1 ≤ k ≤ 107).
Print "YES" without quotes if a potion with efficiency exactly k can be bought in the store and "NO" without quotes otherwise.
You can output each of the letters in any register.
1 10 1 10 1
YES
1 5 6 10 1
NO
分析:水题,将x到y上的每一个数字都乘上k,只要有一个数字大于l并且小于r,就可以YES,如果一个都没有,就NO
下面给出(Python 3.5.2)AC代码:
l,r,x,y,k=map(int,input().split())
ans=0
for i in range(x,y+1):
if (i*k)<=r and (i*k)>=l:
if (ans == 0):
print("YES")
ans=1 if ans == 0:
print("NO")
Codeforces 842A Kirill And The Game【暴力,水】的更多相关文章
- Kirill And The Game CodeForces - 842A
CodeForces - 842A 需要将除法改换成乘法进行计算 #include<bits/stdc++.h> using namespace std; int main() { lon ...
- Codeforces Round #280 (Div. 2) A B C 暴力 水 贪心
A. Vanya and Cubes time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2) A B C D 暴力 水 二分 几何
A. Vicious Keyboard time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces 106D Treasure Island 预处理前缀+暴力(水
主题链接:点击打开链接 意甲冠军: 特定n*m矩阵 # 是墙 . 和字母是平地 最多有26个字母(不反复出现) 以下k个指令. 每一个指令代表移动的方向和步数. 若以某个字母为起点,依次运行全部的指令 ...
- CodeForces 711B Chris and Magic Square (暴力,水题)
题意:给定n*n个矩阵,其中只有一个格子是0,让你填上一个数,使得所有的行列的对角线的和都相等. 析:首先n为1,就随便填,然后就是除了0这一行或者这一列,那么一定有其他的行列是完整的,所以,先把其他 ...
- Codeforces Round #321 (Div. 2)-A. Kefa and First Steps,暴力水过~~
A. Kefa and First Steps time limit per test 2 seconds memory limit per test 256 megabytes input stan ...
- Codeforces 777D:Cloud of Hashtags(水题)
http://codeforces.com/problemset/problem/777/D 题意:给出n道字符串,删除最少的字符使得s[i] <= s[i+1]. 思路:感觉比C水好多啊,大概 ...
- codeforces Gym 100187L L. Ministry of Truth 水题
L. Ministry of Truth Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/p ...
- Codeforces Round #185 (Div. 2) B. Archer 水题
B. Archer Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/312/problem/B D ...
随机推荐
- Java IO学习要点导图
Java IO的一些基础知识: 导图源文件保存地址:https://github.com/wanghaoxi3000/xmind
- DataBase MongoDB高级知识-易使用
MongoDB高级知识-易使用 mongodb是一个面向文档的数据库,而不是关系型数据库.不采用关系模型主要是为了获取更好的扩展性.当然还有其他的一些好处. 与关系型数据库相比,面向文档的数据库不再有 ...
- iOS开发之Xcode常用调试技巧总结
转载自:iOS开发之Xcode常用调试技巧总结 最近在面试,面试过程中问到了一些Xcode常用的调试技巧问题.平常开发过程中用的还挺顺手的,但你要突然让我说,确实一脸懵逼.Debug的技巧很多,比如最 ...
- iOS APP之间到跳转,以及热门应用,手机自带到应用跳转
应用之间的跳转 在第一个APP中,做如下操作:1.在info.plist文件中的"信息属性列表"下添加一项:"URL类型"; 2.点开"URL类型&q ...
- 无 new 构造与链式调用
无 new 构造 最简单的想法 (function(window) { var jQuery = function() { return new _jQuery(); }; var _jQuery = ...
- Pipeline in scala——给scala添加管道操作
linux系统中管道这一功能相信大家肯定使用过,比如现在想找到用户目录下文件名包含db的所有文件,ls ~的结果,作为grep db的参数: ➜ ~ ls ~ | grep db kv.mv.db ...
- GAME——转圈游戏
我们在生命的路上常常绝望 大概是因为弯路走了太多 脚上的泡被磨起又磨破 像我们所有的幻想与梦 起起落落. 所以说 我这道题考场上面和题解想得一模一样啊啊啊啊啊啊啊啊啊啊!!!!!! 但是就是打复杂了啊 ...
- c#加密解密源码,md5、des、rsa
从网上找来的代码,顺手改改,用起来更方便. 配置文件 using System; using System.Collections.Generic; using System.Text; using ...
- JAVA NIO学习三:NIO 的非阻塞式网络通信
紧接着上一章,我们继续来研究NIO,上一章中我们讲了NIO 中最常见的操作即文件通道的操作,但实际上NIO的主要用途还是在于网络通信,那么这个时候就会涉及到选择器,这一章我们就会对其进行讲解操作. 一 ...
- 房上的猫:了解java与学习java前的准备
一.java 概述: 1.通常指完成某些事情的一种既定方式和过程 2.程序可以看做对一系列动作执行过程的描述 3.计算机按照某种顺序完成一系列指令的集合称为程序 4.计算机仅识别二进制低级语言 ...