結果
| 問題 |
No.1006 Share an Integer
|
| コンテスト | |
| ユーザー |
wattaihei
|
| 提出日時 | 2020-03-06 22:20:20 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 325 ms / 2,000 ms |
| コード長 | 537 bytes |
| コンパイル時間 | 210 ms |
| コンパイル使用メモリ | 82,292 KB |
| 実行使用メモリ | 85,792 KB |
| 最終ジャッジ日時 | 2024-10-14 07:53:04 |
| 合計ジャッジ時間 | 4,175 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 |
ソースコード
import sys
input = sys.stdin.readline
X = int(input())
A = [i-1 for i in range(X+1)]
for x in range(2, X+1):
p = x
while p <= X:
A[p] -= 1
p += x
ans = []
s = 10**13
for x in range(1, X):
y = X-x
score = abs(A[x]-A[y])
if score < s:
ans = [(x, y)]
s = score
elif score == s:
ans.append((x, y))
# if X%2 == 0:
# x = X//2
# if s != 0:
# ans = [(x, x)]
# elif s == 0:
# ans.append((x, x))
print("\n".join([str(a)+" "+str(b) for a, b in ans]))
wattaihei