結果

問題 No.1006 Share an Integer
ユーザー tktk_snsntktk_snsn
提出日時 2020-12-19 14:21:47
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 398 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 81,652 KB
実行使用メモリ 201,036 KB
最終ジャッジ日時 2023-10-21 09:11:54
合計ジャッジ時間 27,073 ms
ジャッジサーバーID
(参考情報)
judge12 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 305 ms
75,348 KB
testcase_01 AC 301 ms
75,348 KB
testcase_02 AC 303 ms
77,396 KB
testcase_03 AC 294 ms
75,348 KB
testcase_04 AC 302 ms
77,396 KB
testcase_05 AC 319 ms
77,616 KB
testcase_06 AC 314 ms
77,616 KB
testcase_07 AC 323 ms
77,616 KB
testcase_08 AC 306 ms
77,616 KB
testcase_09 AC 301 ms
77,616 KB
testcase_10 AC 314 ms
77,616 KB
testcase_11 AC 1,497 ms
169,552 KB
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 AC 1,143 ms
139,064 KB
testcase_17 AC 1,472 ms
170,232 KB
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

U = 2 * 10 ** 6
div = [1] * (U + 1)

for i in range(2, U + 1):
    div[i] += 1
    v = i * 2
    while v <= U:
        div[v] += 1
        v += i

X = int(input())
score = []
for a in range(1, X):
    b = X - a
    fa = a - div[a]
    fb = b - div[b]
    score.append((abs(fa-fb), a))

score.sort()
mn = score[0][0]
for s, a in score:
    if s == mn:
        print(a, X - a)
    else:
        break
0