A-10yen Stamp AtCoder Beginner Contest 233
Approach-
If y-x is divisible by 10 answer is simply(y-x)/10 and if it is not divisible by 10, the answer is ((y-x)/10) plus 1. Both of these can be handled by using (ceil) of (y-x)(10.0).
Code-
long long x, y;
cin>>x>>y;
if(x>=y)
cout<<0<<endl;
else
cout<<(ceil)((y-x)/(10.0));
cin>>x>>y;
if(x>=y)
cout<<0<<endl;
else
cout<<(ceil)((y-x)/(10.0));
Disclaimer- Everything is published after the actual contest gets over.
Other Problems from this Contest-
Comments