結果

問題 No.2976 高階多点評価
ユーザー ecottea
提出日時 2024-02-05 19:54:17
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 621 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-09-28 12:08:22
合計ジャッジ時間 6,633 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18 TLE * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

import re
import sys

content = input()
pattern = r'^(\d+)$'
result = re.match(pattern, content)

if not result:
    sys.exit("format error.")

T = int(content)

if not (1 <= T and T <= 10**5):
    sys.exit("T")

for _ in range(T):
    content = input()
    pattern = r'^(\d+) (-?0.\d{5})$'
    result = re.match(pattern, content)

    if not result:
        sys.exit("format error.")

    n, x = content.split()
    n = int(n)
    x = float(x)

    if not (0 <= n and n <= 10**5):
        sys.exit("N")

    res = ((x - 1j)**(-n-1) - (x + 1j)**(-n-1)) * (-1)**n / 2j
    res *= (x**2 + 1)**(n/2 + 1)
    print(res.real)
0