https://codeforces.com/contest/1068
A
1 #include<bits/stdc++.h> 2 using namespace std; 3 #define lson l,mid,rt<<1 4 #define rson mid+1,r,rt<<1|1 5 #define sqr(x) ((x)*(x)) 6 #define pb push_back 7 #define eb emplace_back 8 #define maxn 300005 9 #define eps 1e-8 10 #define pi acos(-1.0) 11 #define rep(k,i,j) for(int k=i;k<j;k++) 12 typedef long long ll; 13 typedef pair<int,int> pii; 14 typedef pair<long long,int>pli; 15 typedef pair<int,char> pic; 16 typedef pair<pair<int,string>,pii> ppp; 17 typedef unsigned long long ull; 18 const long long mod=1e9+7; 19 /*#ifndef ONLINE_JUDGE 20 freopen("1.txt","r",stdin); 21 #endif */ 22 23 24 25 26 int main(){ 27 #ifndef ONLINE_JUDGE 28 // freopen("1.txt","r",stdin); 29 #endif 30 std::ios::sync_with_stdio(false); 31 ll n,m,k,l; 32 cin>>n>>m>>k>>l; 33 if(n<m||n-k<l){ 34 cout<<-1<<endl; 35 return 0; 36 } 37 ll res=(k+l)/m; 38 if(res*m<k+l) ++res; 39 if(res*m<=n) cout<<res<<endl; 40 else cout<<-1<<endl; 41 }