Div2 518A

Revision en3, by yashgulani, 2018-10-24 23:20:12

Why double coins = (double)(k+l)/m and then ceil(coins) works

And this one faila for case 28

ll long long int main() { ll n,m,k,l; cin>>n>>m>>k>>l;

ll coins = ceil((double)(k+l)/m);

if(k+l > n || coins*m > n)
{
    cout<<"-1"<<endl;
}
else {
    cout<<coins<<endl;
}
//main();

}

Thanks in advance

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English yashgulani 2018-10-24 23:20:12 57
en2 English yashgulani 2018-10-24 23:19:13 203
en1 English yashgulani 2018-10-24 23:18:12 439 Initial revision (published)