結果

問題 No.1006 Share an Integer
ユーザー titiatitia
提出日時 2020-03-06 21:37:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 315 ms / 2,000 ms
コード長 356 bytes
コンパイル時間 749 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 99,300 KB
最終ジャッジ日時 2024-04-22 05:23:48
合計ジャッジ時間 8,533 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 291 ms
91,232 KB
testcase_01 AC 283 ms
91,008 KB
testcase_02 AC 288 ms
91,000 KB
testcase_03 AC 286 ms
91,136 KB
testcase_04 AC 282 ms
91,112 KB
testcase_05 AC 285 ms
91,132 KB
testcase_06 AC 286 ms
91,008 KB
testcase_07 AC 283 ms
91,264 KB
testcase_08 AC 279 ms
91,392 KB
testcase_09 AC 293 ms
91,136 KB
testcase_10 AC 285 ms
91,008 KB
testcase_11 AC 309 ms
95,872 KB
testcase_12 AC 308 ms
99,072 KB
testcase_13 AC 315 ms
98,944 KB
testcase_14 AC 301 ms
99,300 KB
testcase_15 AC 302 ms
98,048 KB
testcase_16 AC 303 ms
94,592 KB
testcase_17 AC 310 ms
95,488 KB
testcase_18 AC 307 ms
98,404 KB
testcase_19 AC 308 ms
97,920 KB
testcase_20 AC 312 ms
98,504 KB
testcase_21 AC 305 ms
99,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

X=int(input())

D=[1]*(2*10**6+1)
for i in range(2,2*10**6+1):
    for j in range(i,2*10**6+1,i):
        D[j]+=1

ANS=[0]*(X//2+2)
for i in range(X//2+2):
    ANS[i]=abs((i-D[i])-((X-i)-(D[X-i])))

MIN=min(ANS)

A=[]
for i in range(X//2+1):
    if ANS[i]==MIN:
        A.append((i,X-i))
        A.append((X-i,i))

for x,y in sorted(set(A)):
    print(x,y)
0