結果

問題 No.1006 Share an Integer
ユーザー yakeshibayakeshiba
提出日時 2020-10-31 22:01:39
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 434 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 86,992 KB
実行使用メモリ 273,856 KB
最終ジャッジ日時 2023-09-29 10:48:19
合計ジャッジ時間 7,688 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,324 KB
testcase_01 WA -
testcase_02 AC 74 ms
76,180 KB
testcase_03 AC 69 ms
71,248 KB
testcase_04 AC 73 ms
76,112 KB
testcase_05 AC 75 ms
76,568 KB
testcase_06 WA -
testcase_07 AC 74 ms
76,396 KB
testcase_08 AC 74 ms
76,416 KB
testcase_09 WA -
testcase_10 AC 75 ms
76,552 KB
testcase_11 AC 343 ms
168,864 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 649 ms
273,456 KB
testcase_15 AC 567 ms
246,348 KB
testcase_16 AC 273 ms
145,408 KB
testcase_17 AC 381 ms
189,608 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 535 ms
245,196 KB
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

X = int(input())

n_div = [0]*(X+1)

for i in range(1,X//2+1):
    for j in range(i, X+1, i):
        n_div[j] += 1
    
d = {}
for a in range(1, X//2+1):
    b = X-a
    f = abs((a-n_div[a])-(b-n_div[b]))
    if f not in d:
        d[f] = [[a, b]]
    else:
        d[f].append([a, b])

ans = sorted(d[min(d.keys())])
for v in ans:
    a, b = v
    print(a, b)
    
for v in ans[::-1]:
    a, b = v
    if a != b:
        print(b, a)
0