結果

問題 No.1006 Share an Integer
ユーザー eSeFeSeF
提出日時 2020-02-18 17:57:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 419 bytes
コンパイル時間 329 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 44,344 KB
最終ジャッジ日時 2024-04-21 23:48:20
合計ジャッジ時間 29,484 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 544 ms
43,840 KB
testcase_01 AC 537 ms
43,736 KB
testcase_02 AC 544 ms
43,996 KB
testcase_03 AC 544 ms
43,836 KB
testcase_04 AC 548 ms
43,616 KB
testcase_05 AC 540 ms
43,832 KB
testcase_06 AC 544 ms
43,960 KB
testcase_07 AC 545 ms
43,832 KB
testcase_08 AC 539 ms
43,988 KB
testcase_09 AC 538 ms
43,592 KB
testcase_10 AC 537 ms
44,088 KB
testcase_11 AC 1,461 ms
43,968 KB
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 AC 1,218 ms
43,468 KB
testcase_17 AC 1,499 ms
43,832 KB
testcase_18 TLE -
testcase_19 AC 1,955 ms
43,620 KB
testcase_20 TLE -
testcase_21 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from numpy import sqrt
def f(N):
    d=0;
    for i in range(1,int(sqrt(N))+1):
        if(N%i==0):
            d+=(1 if N/i==i else 2)
    return N-d
X=int(input())
mid=X//2
w=2*(int(sqrt(X))+1)
mindif=X
for i in range(mid-w,mid+w):
  if(i<=0 or X-i<=0):
    continue
  mindif=min(mindif,abs(f(i)-f(X-i)))
for i in range(mid-w,mid+w):
  if(i<=0 or X-i<=0):
    continue
  if(abs(f(i)-f(X-i))==mindif):
    print(i,X-i)
0