結果

問題 No.1006 Share an Integer
ユーザー O2MTO2MT
提出日時 2020-08-15 12:33:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 337 ms / 2,000 ms
コード長 423 bytes
コンパイル時間 197 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 91,648 KB
最終ジャッジ日時 2024-04-19 00:49:06
合計ジャッジ時間 4,513 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
51,968 KB
testcase_01 AC 41 ms
51,968 KB
testcase_02 AC 46 ms
58,624 KB
testcase_03 AC 41 ms
52,096 KB
testcase_04 AC 48 ms
58,752 KB
testcase_05 AC 50 ms
59,904 KB
testcase_06 AC 51 ms
59,520 KB
testcase_07 AC 47 ms
59,648 KB
testcase_08 AC 53 ms
59,392 KB
testcase_09 AC 49 ms
59,392 KB
testcase_10 AC 49 ms
59,648 KB
testcase_11 AC 187 ms
84,736 KB
testcase_12 AC 316 ms
90,880 KB
testcase_13 AC 320 ms
91,264 KB
testcase_14 AC 319 ms
91,392 KB
testcase_15 AC 289 ms
89,216 KB
testcase_16 AC 146 ms
82,048 KB
testcase_17 AC 189 ms
84,992 KB
testcase_18 AC 275 ms
89,344 KB
testcase_19 AC 272 ms
88,960 KB
testcase_20 AC 290 ms
89,600 KB
testcase_21 AC 337 ms
91,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt,floor
N = int(input())
l = [0 for _ in range(N+1)]
ans = []
num = 10**9
for i in range(1,N+1):
  for j in range(i,N,i):
    l[j] += 1

for i in range(max(0,N//2-(floor(sqrt(N)))), N//2+floor(sqrt(N))):
  num = min(num,abs((i-l[i])-(N-i-l[N-i])))

for i in range(N//2-(floor(sqrt(N))), N//2+floor(sqrt(N))):
  if num == abs((i-l[i])-(N-i-l[N-i])):
    ans.append((i,N-i))

for i,j in ans:
  print(i,j)
0