Advertisement
ismaeil

D

Feb 4th, 2020
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. #define int long long
  5. using namespace std;
  6.  
  7. main()
  8. {
  9.     int n ,a ,b ,k;
  10.     cin >> n >> a >> b >> k ;
  11.     int m;
  12.     int ans=0 ;
  13.     for(int i=0 ; i<n ; i++){
  14.         cin >> m;
  15.         int r = m % (a+b);
  16.         if( r <= a && r < 0 ){
  17.             ans++;
  18.         }
  19.         else
  20.         if( r == 0 ){
  21.             r = a+b;
  22.         }
  23.         int v = r / a;
  24.         if( r % a == 0)
  25.             v--;
  26.         if( v <= k ){
  27.             ans ++ ;
  28.             k -= v;
  29.         }
  30.  
  31.     }
  32.     cout << ans << endl;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement