結果
| 問題 | No.1006 Share an Integer |
| コンテスト | |
| ユーザー |
ttr
|
| 提出日時 | 2020-03-06 22:36:25 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 67 ms / 2,000 ms |
| コード長 | 544 bytes |
| 記録 | |
| コンパイル時間 | 297 ms |
| コンパイル使用メモリ | 85,376 KB |
| 実行使用メモリ | 63,488 KB |
| 最終ジャッジ日時 | 2026-05-01 18:02:32 |
| 合計ジャッジ時間 | 2,683 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 |
ソースコード
X = int(input())
def f(n):
cnt = 0
i = 2
while i < n**0.5:
if n%i == 0:
cnt += 2
i += 1
if n**0.5 == int(n**0.5):
cnt += 1
return n-cnt
m = X+1
i = 0
while i < 300 and X//2-i > 0:
m = min(m, abs(f(X//2-i)-f(X-X//2+i)))
i += 1
L = []
i = 0
while i < 300 and X//2-i > 0:
if m == abs(f(X//2-i)-f(X-X//2+i)):
L.append((X//2-i, X-X//2+i))
L.append((X-X//2+i, X//2-i))
i += 1
if X%2 == 0:
L.remove((X//2, X//2))
L.sort()
for l in L:
print(l[0], l[1])
ttr