結果
| 問題 |
No.1256 連続整数列
|
| コンテスト | |
| ユーザー |
rlangevin
|
| 提出日時 | 2024-08-02 08:59:53 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 400 bytes |
| コンパイル時間 | 387 ms |
| コンパイル使用メモリ | 82,708 KB |
| 実行使用メモリ | 75,304 KB |
| 最終ジャッジ日時 | 2024-08-02 08:59:56 |
| 合計ジャッジ時間 | 2,701 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 WA * 3 |
ソースコード
def BinarySearch(yes, no, A, n):
while abs(yes - no) != 1:
mid = (yes + no)//2
if A >= n * mid + n * (n - 1) // 2:
yes = mid
else:
no = mid
return n * yes + n * (n - 1) // 2
A = int(input())
n = 3
while n * (n - 1) // 2 <= A:
B = BinarySearch(-2, 10 ** 9 + 5, A, n)
if A == B:
print("YES")
exit()
n += 1
print("NO")
rlangevin