結果

問題 No.1006 Share an Integer
ユーザー brthyyjpbrthyyjp
提出日時 2020-03-06 23:05:01
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 623 bytes
コンパイル時間 383 ms
コンパイル使用メモリ 82,252 KB
実行使用メモリ 87,048 KB
最終ジャッジ日時 2024-04-22 10:20:14
合計ジャッジ時間 5,342 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
59,684 KB
testcase_01 AC 62 ms
52,864 KB
testcase_02 AC 71 ms
59,788 KB
testcase_03 AC 56 ms
52,480 KB
testcase_04 AC 77 ms
59,904 KB
testcase_05 AC 92 ms
61,568 KB
testcase_06 AC 97 ms
61,696 KB
testcase_07 AC 121 ms
62,208 KB
testcase_08 AC 114 ms
61,312 KB
testcase_09 AC 90 ms
62,208 KB
testcase_10 AC 83 ms
61,824 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 #

x = int(input())

def make_divisors(n):
    divisors = []
    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)

    #divisors.sort(reverse=True)
    return divisors

l = [10**18]* (x//2)
for a in range(1, x//2+1):
    b = x - a
    l[a-1] = abs(a-len(make_divisors(a))-b+len(make_divisors(b)))

min_ = min(l)
anss = []
for i in range(len(l)):
    if l[i] == min_:
        anss.append(i+1)
        if i+1 != x-(i+1):
            anss.append(x-(i+1))
anss.sort()
for i in range(len(anss)):
    print(anss[i], x-anss[i])
0