yashgulani's blog

By yashgulani, history, 6 years ago, In English

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

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By yashgulani, history, 7 years ago, In English

Can anyone please explain how we are able to answer this problem by checking just 1 cycle and how are we are keeping track of that common edge . Thanks !!

Full text and comments »

  • Vote: I like it
  • -6
  • Vote: I do not like it

By yashgulani, history, 7 years ago, In English

IN problem c of testing round 14 held on 22-12-2017 , By using long long the solution is getting tle but by doing type casting the solution gets accepted. http://codeforces.me/contest/910/submission/33517729 ------>>> accepted http://codeforces.me/contest/910/submission/33517599 ------>>> tle Thanks if anyone could help

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it