diff --git a/zeta_python/9020.py b/zeta_python/9020.py deleted file mode 100644 index 68cde05..0000000 --- a/zeta_python/9020.py +++ /dev/null @@ -1,6 +0,0 @@ -N = int(input() -P = [] -last = 2 -for _ in range(N): - - # 골듭흐 파티션 diff --git a/zeta_python/completed/17103.py b/zeta_python/completed/17103.py new file mode 100644 index 0000000..2b51acc --- /dev/null +++ b/zeta_python/completed/17103.py @@ -0,0 +1,27 @@ +import sys + +T = int(sys.stdin.readline()) + +P = [2] +K = [0] * 1000005 +K[2] = True +for i in range(2, 1000000 - 1): + for p in P: + if i % p == 0: + break + elif p * p > i: + P.append(i) + K[i] = 1 + break + else: + P.append(i) + K[i] = 1 + break +for _ in range(T): + n = int(sys.stdin.readline()) + c = 0 + for i in range(2, n//2+1): + if K[i] and K[n - i]: + c += 1 + i += 1 + print(c) diff --git a/zeta_python/completed/6588.py b/zeta_python/completed/6588.py new file mode 100644 index 0000000..51e2446 --- /dev/null +++ b/zeta_python/completed/6588.py @@ -0,0 +1,26 @@ +import sys + +P = [2] +K = [False] * 1000005 +K[2] = True +for i in range(2, 1000000 - 1): + for p in P: + if i % p == 0: + break + elif p * p > i: + P.append(i) + K[i] = True + break + else: + P.append(i) + K[i] = True + break +while True: + n = int(sys.stdin.readline()) + if n == 0: + break + i = 2 + while not (K[i] and K[n - i]): + i += 1 + else: + print(n, "=", i, "+", n - i) diff --git a/zeta_python/completed/9020.py b/zeta_python/completed/9020.py new file mode 100644 index 0000000..3a3b873 --- /dev/null +++ b/zeta_python/completed/9020.py @@ -0,0 +1,26 @@ +T = int(input()) +P = [2] +K = [False, False, True] + [False for i in range(9999)] +last = 2 +for _ in range(T): + n = int(input()) + if n - 2 > last: + for i in range(last, n - 1): + for p in P: + if i % p == 0: + break + elif p * p > i: + P.append(i) + K[i] = True + break + else: + P.append(i) + K[i] = True + break + i = 0 + while not (K[n//2 - i] and K[n//2 + i]): + i += 1 + if n - 1 > last: + last = n - 1 + print(n//2 - i, n//2 + i) +# 골드바흐로 소수 여부를 False/True로 구별해 while 돌리는게 best