結果

問題 No.1006 Share an Integer
ユーザー ogi_welcomeogi_welcome
提出日時 2020-03-06 23:18:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 474 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 88,352 KB
最終ジャッジ日時 2024-04-22 10:33:27
合計ジャッジ時間 12,525 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 682 ms
86,656 KB
testcase_01 AC 718 ms
81,408 KB
testcase_02 AC 703 ms
81,408 KB
testcase_03 AC 714 ms
81,408 KB
testcase_04 AC 709 ms
81,408 KB
testcase_05 AC 725 ms
81,280 KB
testcase_06 AC 746 ms
81,408 KB
testcase_07 AC 720 ms
81,280 KB
testcase_08 AC 749 ms
81,280 KB
testcase_09 AC 726 ms
81,408 KB
testcase_10 AC 754 ms
81,408 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 #

def f(n):
    m=n
    l=[]
    for i in range(2,n):
      if n%i==0:
        cnt=0
        while n%i==0:
          cnt+=1
          n//=i
        l.append((i,cnt))
    ans=1
    if len(l)==0:
      l.append((n,1))
    for k in l:
      ans*=(k[1]+1)
    return ans
x=int(input())
e=[[] for i in range(10**6+1)]
q=10**6+2
for i in range(max(1,x//2-100),min(x,x//2+100)):
    r=abs(i-f(i)-(x-i)+f(x-i))
    e[r].append((i,x-i))
    q=min(q,r)
for j in e[q]:
  print(j[0],j[1])
0