結果
| 問題 | No.648 お や す み |
| コンテスト | |
| ユーザー |
Ytz_Ichi
|
| 提出日時 | 2020-02-18 23:53:15 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 120 ms / 2,000 ms |
| コード長 | 413 bytes |
| 記録 | |
| コンパイル時間 | 536 ms |
| コンパイル使用メモリ | 20,656 KB |
| 実行使用メモリ | 15,708 KB |
| 最終ジャッジ日時 | 2026-04-22 21:12:19 |
| 合計ジャッジ時間 | 12,103 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 84 |
ソースコード
import sys
import math
from decimal import *
getcontext().prec = 40
n = int(input())
drn = 1 + ((n - 1) % 9)
if drn == 1 or drn == 3 or drn == 6 or drn == 9:
triangular = Decimal(8 * n + 1).sqrt()
if triangular.quantize(Decimal("0"), rounding=ROUND_UP) == triangular.quantize(
Decimal("0"), rounding=ROUND_DOWN
):
print(f"YES\n{(int(triangular)-1)//2}")
sys.exit()
print("NO")
Ytz_Ichi