結果

問題 No.1006 Share an Integer
ユーザー s_shoheis_shohei
提出日時 2020-04-11 15:01:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 505 bytes
コンパイル時間 222 ms
コンパイル使用メモリ 81,536 KB
実行使用メモリ 77,168 KB
最終ジャッジ日時 2023-10-19 06:07:06
合計ジャッジ時間 3,831 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
55,580 KB
testcase_01 AC 46 ms
55,580 KB
testcase_02 AC 59 ms
66,176 KB
testcase_03 AC 46 ms
55,372 KB
testcase_04 AC 62 ms
68,224 KB
testcase_05 AC 73 ms
72,668 KB
testcase_06 AC 73 ms
72,668 KB
testcase_07 AC 75 ms
72,924 KB
testcase_08 AC 72 ms
72,668 KB
testcase_09 AC 75 ms
73,016 KB
testcase_10 AC 71 ms
72,668 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

x=int(input())

def m_div(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)
    return divisors

from functools import lru_cache
@lru_cache(maxsize=None)
def f(num):
    return num - len(m_div(num))

mn = float("inf")
st=max(1,x-5000)
for a in range(st,x):
    b=x-a
    mn=min(mn,abs(f(a)-f(b)))

for a in range(st,x):
    b=x-a
    if abs(f(a)-f(b))==mn:
        print(a,b)
0