結果

問題 No.1006 Share an Integer
ユーザー Ohnuma
提出日時 2020-04-05 23:24:38
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 480 bytes
コンパイル時間 208 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 23,456 KB
最終ジャッジ日時 2024-07-04 15:15:32
合計ジャッジ時間 4,237 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7 RE * 1 TLE * 1 -- * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

def divisor(x):
    tank = []
    for i in range(1, int(x**0.5)+1):
        if x%i==0:
            tank.append(i)
            if i!=x//i:
                tank.append(x//i)
    tank.sort()
    return tank

x = int(input())
ans = []
for a in range(1, x-1):
    b = x-a
    fa = a - len(divisor(a))
    fb = b - len(divisor(b))
    ans.append((abs(fa-fb), a, b))
ans.sort(key=lambda x:x[0])

mn = ans[0][0]

for n,a,b in ans:
    if n!=mn:
        break
    else:
        print(a, b)
0