x,y=map(int,input().split())
start=0
end=x
z=(y*100)//x
result=0
while start<=end:
mid=(start+end)//2
z2=((y+mid)*100)//(x+mid)
if z!=z2:
result=mid
end=mid-1
else:
start=mid+1
if result==0:
print('-1')
else:
print(result)
역시 이진탐색임을 알고 풀면 문제가 쉽다.
유의할 점은
int((y/x)100) 라고 하면 에러가 뜨고
(y100)//x 라고 하면 정상적으로 작동한다.
https://www.acmicpc.net/board/view/53623
잘 설명된 글이 있길래 참고하면 좋겠다