結果
| 問題 | No.1006 Share an Integer |
| コンテスト | |
| ユーザー |
wattaihei
|
| 提出日時 | 2020-03-06 22:12:53 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 637 bytes |
| 記録 | |
| コンパイル時間 | 321 ms |
| コンパイル使用メモリ | 20,696 KB |
| 実行使用メモリ | 64,604 KB |
| 最終ジャッジ日時 | 2026-05-01 16:53:31 |
| 合計ジャッジ時間 | 5,568 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 4 WA * 4 TLE * 1 -- * 10 |
ソースコード
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//2+1):
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]))
if ans[-1][0] == ans[-1][1]:
ans.pop()
print("\n".join([str(b)+" "+str(a) for a, b in ans[::-1]]))
wattaihei