結果
| 問題 | No.648 お や す み |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-15 23:43:29 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 162 ms / 2,000 ms |
| コード長 | 430 bytes |
| 記録 | |
| コンパイル時間 | 604 ms |
| コンパイル使用メモリ | 20,824 KB |
| 実行使用メモリ | 15,592 KB |
| 最終ジャッジ日時 | 2026-04-18 00:46:08 |
| 合計ジャッジ時間 | 18,772 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 84 |
ソースコード
from decimal import *
i=Decimal(input())
x=1
def df(n):
return 2*n
def f(n):
return Decimal(0.5)*(n**2)+Decimal(0.5)*n-i
def s(n):
return Decimal(0.5)*(n**2)+Decimal(0.5)*n
op=1
while True:
prev=x
x=x-(f(x)/df(x)) # ニュートン法
if abs(prev - x) < 0.01:
break
x=Decimal(int(x-3))
for j in range(6):
x=x+1
if s(x)==i:
print("YES")
print(x)
exit()
print("NO")