Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- ios_base::sync_with_stdio(false);
- cin.tie(nullptr);
- cout.tie(nullptr);
- int N, L, U;
- cin >> N >> L >> U;
- if(L > N) {
- cout << "-1";
- return 0;
- }
- if(N <= U) {
- cout << "1";
- return 0;
- }
- for(int i = U; i >= L; --i)
- if(N % i == 0 || N % i >= L) {
- cout << N / i + (N % i != 0);
- return 0;
- }
- cout << "-1";
- }
Advertisement
Add Comment
Please, Sign In to add comment