본문 바로가기

Python(알고리즘,문제풀이)/BOJ(Bronze II)

백준 / 1075번 / 나누기 / Python / 브루트포스 알고리즘

728x90

📚문제

출처 : 백준 1075번(https://www.acmicpc.net/problem/1075)


📝풀이

# 1075번 나누기 (Bronze II)
n = input()
f = int(input())
for i in range(100):
    if len(str(i)) < 2:
        n = int(str(n)[:-2] + '0' + str(i))
        if n % f ==0:
            print('0' + str(i))
            break
    else:
        n = int(str(n)[:-2] + str(i))
        if n % f ==0:
            print(str(i))
            break
728x90