結果

問題 No.1006 Share an Integer
ユーザー ogi_welcomeogi_welcome
提出日時 2020-03-06 22:57:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 537 bytes
コンパイル時間 383 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 89,372 KB
最終ジャッジ日時 2024-04-22 10:11:33
合計ジャッジ時間 20,524 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 833 ms
89,216 KB
testcase_01 WA -
testcase_02 AC 839 ms
89,220 KB
testcase_03 AC 832 ms
89,244 KB
testcase_04 AC 830 ms
89,324 KB
testcase_05 AC 826 ms
89,284 KB
testcase_06 AC 832 ms
89,204 KB
testcase_07 AC 834 ms
89,220 KB
testcase_08 AC 824 ms
89,208 KB
testcase_09 AC 834 ms
89,328 KB
testcase_10 AC 838 ms
89,324 KB
testcase_11 AC 850 ms
89,216 KB
testcase_12 AC 862 ms
89,220 KB
testcase_13 AC 848 ms
89,364 KB
testcase_14 RE -
testcase_15 AC 852 ms
89,208 KB
testcase_16 AC 847 ms
89,212 KB
testcase_17 AC 856 ms
89,224 KB
testcase_18 AC 872 ms
89,220 KB
testcase_19 AC 864 ms
89,220 KB
testcase_20 AC 854 ms
89,356 KB
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

d=[0]*(10**6+1)
def f(n):
    if d[n]!=0:
        return d[n]
    l=[]
    for i in range(2,int(n**0.5)+1):
      if n%i==0:
        cnt=0
        while n%i==0:
          cnt+=1
          n//=i
        l.append((i,cnt))
    if n>1:
      l.append((n,1))
    ans=1
    for k in l:
      ans*=(k[1]+1)
    d[n]=ans
    return ans
x=int(input())
e=[[] for i in range(10**6+1)]
q=10**6+1
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