Advertisement
Mirbek

ЯБЛОКИ

Feb 4th, 2022
514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int osel(int x) {
  7.     return 5;
  8. }
  9.  
  10. int At(int x) {
  11.     int res = 0;
  12.     while (x > 0) {
  13.         x -= 20;
  14.         res++;
  15.         if (x <= 0)
  16.             break;
  17.         res++;
  18.     }
  19.     return res;
  20. }
  21.  
  22. int main(){
  23.     int q, ans = 0;
  24.     cin >> q;
  25.  
  26.     while (q >= 200) {
  27.         ans += 5;
  28.         q -= 200;
  29.         if (q == 0) {
  30.             break;
  31.         }
  32.         ans += 3;
  33.     }
  34.  
  35.     cout << ans + min(osel(q), At(q));
  36. }
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement