The Embarrassed Cryptographer / 좋은 암호 [BOJ 2061]

HyunMin Yang·2022년 8월 13일
1
post-thumbnail

Problem Solving

Baekjoon: The Embarrassed Cryptographer (좋은 암호)

Code:

K,L=map(int,input().split())
tru=True
for i in range(2,L):
    if K%i==0:
        print("BAD",i)
        tru=False
        break
if tru:
    print("GOOD")

This question is really simple. K, the key and L,the wanted minimum value of factors in a key is inputed and the variable tru is set to true

K,L=map(int,input().split())
tru=True

If K is divisible by i which is in range, the variable tru becomes False and than prints out BAD with i which is a factor of K.

for i in range(2,L):
    if K%i==0:
        print("BAD",i)
        tru=False
        break

However, if the answer is True, we print out GOOD.

if tru:
    print("GOOD")

Similar Problems: 암호제작 The Embarrassed Cryptographer
#같은 방법으로 풀수있어요!

profile
Hello World!

0개의 댓글