結果

問題 No.1006 Share an Integer
ユーザー komkompikomkompi
提出日時 2020-03-22 17:01:37
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 617 bytes
コンパイル時間 568 ms
コンパイル使用メモリ 86,916 KB
実行使用メモリ 119,216 KB
最終ジャッジ日時 2023-08-26 05:38:15
合計ジャッジ時間 5,310 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,700 KB
testcase_01 AC 69 ms
71,824 KB
testcase_02 AC 74 ms
76,196 KB
testcase_03 RE -
testcase_04 AC 79 ms
76,432 KB
testcase_05 AC 79 ms
76,588 KB
testcase_06 AC 77 ms
76,688 KB
testcase_07 AC 77 ms
76,264 KB
testcase_08 AC 77 ms
76,516 KB
testcase_09 AC 81 ms
76,352 KB
testcase_10 AC 77 ms
76,628 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 #

# coding: utf-8
# Your code here!
def count(num):
    N=int(num**0.5)//1
    
    count=0
    for i in range(1,N+1):
        if num/i==num//i:
            count+=2
    if num**0.5==N:
        count-=1
    return count

X=int(input())

A=X//2

ans=[]

for a in range(1,A+1):
    b=X-a
    fa=a-count(a)
    fb=b-count(b)
    score=abs(fa-fb)
    ans.append([score,a,b])
    ans.append([score,b,a])
ans.sort(key=lambda x: x[1])    
ans.sort(key=lambda x: x[0])

base=ans[0][0]
index=0
while ans[index][0]==base:
    print(ans[index][1],ans[index][2])
    if ans[index]==ans[index+1]:
        index+=1
    index+=1

    
0