結果

問題 No.1006 Share an Integer
ユーザー wattaiheiwattaihei
提出日時 2020-03-06 22:06:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 474 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 82,248 KB
実行使用メモリ 85,124 KB
最終ジャッジ日時 2024-04-22 07:53:52
合計ジャッジ時間 4,437 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,096 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 44 ms
57,984 KB
testcase_09 WA -
testcase_10 AC 45 ms
57,984 KB
testcase_11 AC 150 ms
73,728 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 330 ms
83,968 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 258 ms
81,536 KB
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

X = int(input())
A = [i-1 for i in range(X+1)]
for x in range(2, X+1):
    p = x
    while p <= X:
        A[p] -= 1
        p += x

ans = []
s = 10**13
for x in range(1, X//2+1):
    y = X-x
    score = abs(A[x]-A[y])
    if score < s:
        ans = [(x, y)]
        s = score
    elif score == s:
        ans.append((x, y))

print("\n".join([str(a)+" "+str(b) for a, b in ans]))
print("\n".join([str(b)+" "+str(a) for a, b in ans]))
0