codeforces 842 A. Kirill And The Game(阅读题)
来源:互联网 发布:织梦模板html源码 编辑:程序博客网 时间:2024/05/17 14:24
题意:
给你两个区间[L,R].[X,Y],,和一个整数k。求是否能从第一个区间中取一个整数a,第二个区间取一个整数b,使得a/b恰好等于k。
思路:
由于a,b,k为整数,为避免a/b自动取整问题,,所以要判断b*k等于a。。但是不能直接判断[k*x,k*y]与[[l,r]是否有交集来判断存不存在,,因为这两个区间是不连续的,只能取整数。
hack数据:70 70 1 50 50
代码:
#include <bits/stdc++.h>using namespace std;int main(){ long long l,r,x,y,k; cin>>l>>r>>x>>y>>k; for(int i = x;i<=y;i++) { if(k*i>=l&&k*i<=r) { printf("YES"); return 0; } } printf("NO"); return 0;}
阅读全文
1 0
- codeforces 842 A. Kirill And The Game(阅读题)
- Codeforces 842 A Kirill And The Game
- (数学水题)Codeforces A. Kirill And The Game
- Codeforces 842A. Kirill And The Game (暴力)
- A. Kirill And The Game
- Codeforces Round #430 (Div. 2) A. Kirill And The Game
- Codeforces Round #430 (Div. 2) A. Kirill And The Game
- Codeforces #430(div2) A. Kirill And The Game
- Kirill And The Game
- A. Kirill And The Game #430 (Div. 2)
- codeforces:A. The Great Game
- 【Codeforces Round】351A - Bear and Game(水)
- CodeForces - 673A Bear and Game (模拟)水
- Codeforces 365(Div.2)A.Mishka and Game【水题】
- 【Codeforces】-703A-Mishka and Game(水)
- CodeForces 833 A.The Meaningless Game(水~)
- Codeforces 389A Fox and Number Game
- codeforces A. Fox and Number Game
- 论最恶心的公司老板
- K-Means聚类算法及延伸
- spring的基本注解使用demo
- <数据结构与算法>二分查找(折半查找)
- StringUtils的isBlank与isEmply
- codeforces 842 A. Kirill And The Game(阅读题)
- Codeforces Round #430 (Div. 2) 题解
- linux下vim命令详解
- 交换序列a,b 中的元素,使两序列的和之差最小
- 使用kuberspay部署高可用kubernetes集群
- Docker技术剖析--docker的详细简介及安装
- mybatis简单使用
- java的jar包加密及使用
- 【python txt合并】python合并同一个文件夹下所有txt文件