結果
問題 |
No.1006 Share an Integer
|
ユーザー |
![]() |
提出日時 | 2020-03-06 22:07:34 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 480 bytes |
コンパイル時間 | 149 ms |
コンパイル使用メモリ | 82,228 KB |
実行使用メモリ | 84,468 KB |
最終ジャッジ日時 | 2024-10-14 07:10:15 |
合計ジャッジ時間 | 3,691 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 WA * 7 |
ソースコード
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)) print("\n".join([str(a)+" "+str(b) for a, b in ans])) print("\n".join([str(b)+" "+str(a) for a, b in ans[::-1]]))