結果

問題 No.1006 Share an Integer
ユーザー maspy
提出日時 2020-03-06 21:28:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 441 ms / 2,000 ms
コード長 470 bytes
コンパイル時間 185 ms
コンパイル使用メモリ 82,248 KB
実行使用メモリ 107,136 KB
最終ジャッジ日時 2024-10-14 04:09:13
合計ジャッジ時間 8,298 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# %%
U = 2 * 10 ** 6 + 10
F = list(range(U))
for n in range(1, U):
    for m in range(n, U, n):
        F[m] -= 1

# %%
X = int(read())
# %%
diff = [abs(F[A] - F[X - A]) for A in range(X + 1)]
min_diff = min(diff)
ind = [i for i, x in enumerate(diff) if x == min_diff]
for a in ind:
    if 0 < a < X:
        print(a, X - a)
0