結果

問題 No.1006 Share an Integer
ユーザー yakeshibayakeshiba
提出日時 2020-10-31 22:04:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 749 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 10,764 KB
実行使用メモリ 8,752 KB
最終ジャッジ日時 2023-09-29 10:48:25
合計ジャッジ時間 4,331 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,720 KB
testcase_01 AC 16 ms
7,860 KB
testcase_02 AC 18 ms
8,268 KB
testcase_03 AC 15 ms
7,812 KB
testcase_04 AC 18 ms
8,316 KB
testcase_05 AC 19 ms
8,464 KB
testcase_06 AC 19 ms
8,392 KB
testcase_07 AC 20 ms
8,308 KB
testcase_08 AC 18 ms
8,344 KB
testcase_09 AC 19 ms
8,396 KB
testcase_10 AC 18 ms
8,364 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def make_divisors(n):
    from collections import deque
    divisors = deque([])
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    lst_divisors = list(divisors)
    lst_divisors.sort()
    return lst_divisors

X = int(input())

n_div = [0]*(X+1)

for i in range(1,X+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