結果

問題 No.1006 Share an Integer
ユーザー syunsukesyunsuke
提出日時 2020-09-01 22:28:07
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 409 bytes
コンパイル時間 223 ms
コンパイル使用メモリ 82,324 KB
実行使用メモリ 77,212 KB
最終ジャッジ日時 2024-04-30 21:26:20
合計ジャッジ時間 4,483 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
60,608 KB
testcase_01 AC 43 ms
58,312 KB
testcase_02 AC 48 ms
60,236 KB
testcase_03 WA -
testcase_04 AC 48 ms
60,712 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 52 ms
60,816 KB
testcase_09 AC 58 ms
62,360 KB
testcase_10 AC 53 ms
60,996 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 #

N=int(input())
L=[1 for i in range(N+1)]
for i in range(2,N+1):
    for j in range(1,N+1):
        if i*j<=N:
            L[i*j]+=1
#print(L)
SA=10**9
ans=[]
for i in range(1,(N+1)//2):
    A=i-L[i]
    B=(N-i)-L[(N-i)]
    if abs(A-B)<SA:
        SA=abs(A-B)
        ans=[[i,N-i]]
    elif abs(A-B)==SA:
        ans.append([i,N-i])
for i in ans:
    print(*i)
ANS=ans[::-1]
for i in ANS:
    print(i[1],i[0])
0