(数学水题)Codeforces A. Kirill And The Game
来源:互联网 发布:类似iebook的软件 编辑:程序博客网 时间:2024/05/18 05:44
题目网址: A. Kirill And The Game
题意分析:
- 给你两个区间 A:[l,r], B: [x,y] 和一个整数k。求是否存在 a∈A,b∈B 使得a/b恰好等于k。
思路
- 由于a, b, k为整数,避免小数问题,采取判断 b*k是否等于a。但不能直接判断[k*x,k*y]与 [[l,r] 是否有交集来判断存不存在。因为这两个区间是不连续的,只能取整数。
hack的数据
- 5 5 1 2 3
代码
#include <bits/stdc++.h>using namespace std;int main(int argc, char const *argv[]){ long long l, r, x, y, k; while (~scanf("%I64d %I64d %I64d %I64d %I64d", &l, &r, &x, &y, &k)) { int i; for (i = x; i <= y; ++i) { if (k*i >= l && k *i <= r) break; } if (i <= y) printf("YES\n"); else printf("NO\n"); } return 0;}
阅读全文
0 0
- (数学水题)Codeforces A. Kirill And The Game
- codeforces 842 A. Kirill And The Game(阅读题)
- Codeforces 842 A Kirill And The Game
- A. Kirill And The Game
- Codeforces Round #430 (Div. 2) A. Kirill And The Game
- Codeforces 842A. 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 426 Div2C 833A The Meaningless Game(二分||数学)
- (CodeForces 883A) The Meaningless Game 纯正的数学思维题(有点卡cin时间)
- 【Codeforces Round】351A - Bear and Game(水)
- CodeForces - 673A Bear and Game (模拟)水
- 【Codeforces】-703A-Mishka and Game(水)
- codeforces 703 A. Mishka and Game (水)
- CodeForces--621A--Wet Shark and Odd and Even(数学水题)
- CodeForces 833 A.The Meaningless Game(水~)
- 拖拽最简单的实现方式[JQuery实现]
- 图像处理控件Graphics Mill for .NET更新至v9.1.28,支持PSD
- Gym
- reason: 'Cannot modify constraints for UITabBar managed by a controller'
- android Html.fromHtml font 标签支持设置字体大小和颜色
- (数学水题)Codeforces A. Kirill And The Game
- 第十三章 多种I/O复用
- .NET Core 2将Visual Basic带到了Linux和macOS平台
- string转char*
- Kafka 安装与配置
- SQL语言第一节:SQL语言分类
- Docker入门,从0到1
- Spring-boot-redis序列化Date数据类型
- WEB开发----spring boot与mybatis整合