Codeforces 397B On Corruption and Numbers(数论)
来源:互联网 发布:ae2015cc mac破解版 编辑:程序博客网 时间:2024/05/24 06:10
题目链接:Codeforces 397B On Corruption and Numbers
题目大意:给出n,l,r,表示用l~r中间任何数的面值若干个组成n,可以输出Yes,不可以输出No。
解题思路:一开想到dp的一道题,当l*k ≤r*(k-1)的时候,l*(k-1)往上就可以全部可行,但是超时了。
起始可以换个简单的想法, 找到最接近n的f,f为l的倍数,即l*k ≤ n,然后判断,如果r*k≥n的话,即为可行。
#include <stdio.h>#include <string.h>#include <iostream>using namespace std;typedef long long ll;ll n, l, r;bool judge () {ll k = n / l;return r * k >= n;}int main () {int cas;scanf("%d", &cas);while (cas--) {cin >> n >> l >> r;printf("%s\n", judge() ? "Yes" : "No");}return 0;}
0 0
- Codeforces 397B On Corruption and Numbers(数论)
- codeforces 397B. On Corruption and Numbers
- codeforces 397B On Corruption and Numbers
- 【CodeForces 397B 】On Corruption and Numbers(规律)
- codefoeces B 397 - On Corruption and Numbers
- B. On Corruption and Numbers
- Codeforces Round #232 (Div. 2) B. On Corruption and Numbers
- Codeforces Round #232 (Div. 2)-B. On Corruption and Numbers
- codeforces 397B On Corruption and Numbers-yy-(求区间内的整数能否凑成某一整数)
- 【简单题】【数学】-CF-397B-On Corruption and Numbers
- code forces 397B On Corruption and Numbers
- On Corruption and Numbers
- Codeforces Round #232 (Div. 2) B. On Corruption and Numbers 题解
- Codeforces Round #232 (Div. 2) B.On Corruption and Numbers(整数拆分)
- Codeforces_397B_On Corruption and Numbers(数论)
- On Corruption and Numbers(l-r)
- codeforces#232_div2_B On Corruption and Numbers 多元不定方程非负整数解
- Codeforces 385C Bear and Prime Numbers(数论)
- iOS 中如何添加应用自己的字体
- 最短路
- OS定位操作,获取当前位置,计算两点之间距离
- HTC推出Power To Give测试版应用:欲打造能解决世界级难题的“超级计算机”
- 学习CSS了解单位em和px的区别
- Codeforces 397B On Corruption and Numbers(数论)
- CoreAnimation-CATransform3D-1
- 在EXCEL 2010里画斜线(斜线表头)
- 进程及进程间通信IPC
- 一个人的旅行
- Codeforces Round #232 (Div. 2) B. On Corruption and Numbers
- web.xml中openEntityManagerInViewFilter的作用
- 谷歌眼镜"图片识别技术"现身
- 使用Objective-C的+(void)initialize初始化static变量