結果

問題 No.2971 無理積分
コンテスト
ユーザー Yukino DX.
提出日時 2024-12-17 23:00:41
言語 PyPy3
(8.0.1 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 926 ms / 1,000 ms
+ 668µs
コード長 381 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 353 ms
コンパイル使用メモリ 82,752 KB
実行使用メモリ 65,092 KB
最終ジャッジ日時 2026-10-04 21:01:39
合計ジャッジ時間 36,888 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import time
import random
from math import sqrt

def f(x, n):
    return sqrt(x * x * x + n * n * n)


def main():
    n = int(input())

    start = time.time()
    ans, cnt_loop = 0, 0

    while (time.time() - start) < 0.9:
        x = random.uniform(0, 1)
        ans += f(x, n)
        cnt_loop += 1

    ans /= cnt_loop

    print(ans)


if __name__ == "__main__":
    main()
0