[백준] 6588번 : 골드바흐의 추측 - Python(파이썬)

강재원·2022년 10월 21일
0

[코딩테스트] Python

목록 보기
140/200



https://www.acmicpc.net/problem/6588

import math
def check(n):
    for i in range(2,int(math.sqrt(n))+1):
        if n%i==0: return False
    return True

while True:
    n=int(input())
    if n==0: break
    k=0
    a=0
    for i in range(3,n//2+1):
        if check(i) and check(n-i):
            k=1
            a=i
            break
    if k==1: print("%d = %d + %d" %(n,i,n-i))
profile
개념정리 & 문법 정리 & 알고리즘 공부

0개의 댓글