結果

問題 No.1006 Share an Integer
ユーザー DrDrpilotDrDrpilot
提出日時 2022-06-18 18:56:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 319 ms / 2,000 ms
コード長 304 bytes
コンパイル時間 145 ms
コンパイル使用メモリ 81,588 KB
実行使用メモリ 91,808 KB
最終ジャッジ日時 2024-04-18 16:26:14
合計ジャッジ時間 7,638 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 241 ms
91,332 KB
testcase_01 AC 255 ms
90,496 KB
testcase_02 AC 274 ms
91,056 KB
testcase_03 AC 253 ms
90,540 KB
testcase_04 AC 275 ms
91,148 KB
testcase_05 AC 256 ms
91,104 KB
testcase_06 AC 280 ms
91,312 KB
testcase_07 AC 273 ms
91,356 KB
testcase_08 AC 262 ms
91,352 KB
testcase_09 AC 284 ms
91,044 KB
testcase_10 AC 248 ms
90,428 KB
testcase_11 AC 319 ms
90,872 KB
testcase_12 AC 312 ms
91,324 KB
testcase_13 AC 307 ms
90,724 KB
testcase_14 AC 319 ms
90,688 KB
testcase_15 AC 306 ms
91,804 KB
testcase_16 AC 265 ms
90,868 KB
testcase_17 AC 319 ms
91,808 KB
testcase_18 AC 286 ms
91,480 KB
testcase_19 AC 317 ms
91,068 KB
testcase_20 AC 296 ms
90,988 KB
testcase_21 AC 317 ms
91,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

x=int(input())
lis=[0]*(2*10**6+1)
for i in range(1,2*10**6+1):
    for j in range(i,2*10**6+1,i):
        lis[j]+=1
ans=10**18
for a in range(1,x):
    b=x-a
    f_a=a-lis[a];f_b=b-lis[b]
    ans=min(ans,abs(f_a-f_b))
for a in range(1,x):
    b=x-a
    if abs(a-lis[a]-b+lis[b])==ans:
        print(a,b)
0