Skip to main content

A_10yen Stamp AtCoder Beginner Contest 233 (C++ Code and Explanation)

A-10yen Stamp AtCoder Beginner Contest 233 


Problem-
 https://atcoder.jp/contests/abc233/tasks/abc233_a

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));

Disclaimer- Everything is published after the actual contest gets over.

Other Problems from this Contest-


Comments