Test instructions: To find whether a continuous integer can be formed into an integer n. Unlimited number of integers within a range
Analysis: The problem of the coin chip, so I just started thinking is DP, infinite backpack, but found not knapsack problem, but I still think it is a DP, so wrote a transfer equation, it seems to be right, ready to write code when the use of DP words, the array simply can not open so big 10^ 9, so I am sure is not DP, according to experience that should be a yy problem, and then began to manually find the law, found that: as long as n in the interval k[l,r] inside, you can use the integer in the interval to make n, in other words, can find a valid K can, namely: N/R <= n/l, pay attention to: when n%r= =0 when the left end point directly with N/R, otherwise to use n/r+1, here to notice, in many problems have this small details.
Code:
#include <iostream>using namespace Std;int main () {int t;int n,l,r;cin>>t;while (t--) {cin>>n>> L>>r;int a=n/l;int b;if (n%r==0) b=n/r;else b=n/r+1;if (b<=a) cout<< "Yes" <<endl;else cout<< "No" <<endl;}}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Codeforces 397B on corruption and numbers-yy-(the integer within the interval can be formed into an integer)