Alex_tz307

IOIT IT - boardgame - 60p

Dec 15th, 2020
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     ios_base::sync_with_stdio(false);
  7.     cin.tie(nullptr);
  8.     cout.tie(nullptr);
  9.     int N, L, U;
  10.     cin >> N >> L >> U;
  11.     if(L > N) {
  12.         cout << "-1";
  13.         return 0;
  14.     }
  15.     if(N <= U) {
  16.         cout << "1";
  17.         return 0;
  18.     }
  19.     for(int i = U; i >= L; --i)
  20.         if(N % i == 0 || N % i >= L) {
  21.             cout << N / i + (N % i != 0);
  22.             return 0;
  23.         }
  24.     cout << "-1";
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment