Pastebin
API
tools
faq
paste
Login
Sign up
SHARE
TWEET
codeforce - fight with monsters
jakaria_hossain
Feb 5th, 2020
136
Never
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!
C++
1.05 KB
raw
download
clone
embed
print
report
RAW Paste Data
#include<bits/stdc++.h> using namespace std; #define ll long long #define fast()(ios_base::sync_with_stdio(0),cin.tie(NULL)); int main() { fast() ll n,a,b,k; cin>>n>>a>>b>>k; ll ara[n+1],sub[n+1],j=0; for(ll i=0; i<n; i++) cin>>ara[i]; ll x= a+b; ll ans=0; for(ll i=0; i<n; i++) { ara[i]%=x; if(ara[i]<=a && ara[i]) ans++; else { if(ara[i]==0) sub[j++]=x; else sub[j++]=ara[i]; } } sort(sub,sub+j); //for(ll i=0; i < j; i++)cout<<sub[i]<<" "; for(ll i=0; i < j; i++) { ll q=sub[i]/a; k-=(q); if(sub[i]%a==0)k++; ans++; //cout<<"test "<<k<<endl; if(k<0) { ans--; break; } if(k<=0)break; } cout<<ans<<endl; }
Public Pastes
Untitled
C | 8 min ago
Super Filter 8.0
PHP | 16 min ago
drupal - Price Res...
PHP | 24 min ago
teabase64
JSON | 24 min ago
drupal - formatter
PHP | 25 min ago
Untitled-1
C | 25 min ago
getMacAddr.sh
Bash | 32 min ago
systemd commands
Bash | 35 min ago
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!