結果

問題 No.3361 2解間格子点
コンテスト
ユーザー NyaanNyaan
提出日時 2025-11-14 21:41:43
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 338 bytes
コンパイル時間 190 ms
コンパイル使用メモリ 12,160 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2025-11-14 21:42:02
合計ジャッジ時間 4,205 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 65
権限があれば一括ダウンロードができます

ソースコード

diff #

import decimal

decimal.getcontext().prec = 1000
A, B, C = map(decimal.Decimal, input().split())
if A < 0:
    A = -A
    B = -B
    C = -C
D = (B * B - 4 * A * C).sqrt()
L = (-B - D) / (2 * A)
R = (-B + D) / (2 * A)

l = L.__ceil__()
while not L<l: l+=1
while L<l-1:l-=1
r=R.__ceil__()
while not r<R: r-=1
while r+1<R:r+=1

print(r-l+1)
0