結果
問題 |
No.648 お や す み
|
ユーザー |
|
提出日時 | 2018-04-12 14:09:25 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 34 ms / 2,000 ms |
コード長 | 353 bytes |
コンパイル時間 | 269 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,392 KB |
最終ジャッジ日時 | 2024-09-13 21:33:56 |
合計ジャッジ時間 | 5,113 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 84 |
ソースコード
import math from decimal import * getcontext().prec = 40 n = int(input()) s, t = 1, int(2e9) def f(x): return (Decimal(x) * Decimal(x + 1) / Decimal(2)) while(s <= t): x = (s + t) // 2 if f(x) == n: print("YES") print(x) break elif f(x) > n: t = x - 1 else: s = x + 1 else: print("NO")