結果
| 問題 | No.1006 Share an Integer |
| コンテスト | |
| ユーザー |
wattaihei
|
| 提出日時 | 2020-03-06 22:12:53 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 637 bytes |
| 記録 | |
| コンパイル時間 | 123 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 61,476 KB |
| 最終ジャッジ日時 | 2024-10-14 07:21:04 |
| 合計ジャッジ時間 | 4,086 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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