Problem Link : http://codeforces.com/contest/488/problem/A
We just need to make an function of finding whether a number has a digit 8 or not..... &
For -9<x<0 answer will be 8-x
For x>=0 iterate up from x till the answer
Don't forget to take number as long integer :P
We just need to make an function of finding whether a number has a digit 8 or not..... &
For -9<x<0 answer will be 8-x
For x>=0 iterate up from x till the answer
For x<-8 iterate down from abs(x) till the answer
Sample Test Cases:
Answer
-192 3/-189
192 6/198
-7 15/8
Don't forget to take number as long integer :P
No comments:
Post a Comment