結果
問題 |
No.2971 無理積分
|
ユーザー |
|
提出日時 | 2024-12-17 23:00:41 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 944 ms / 1,000 ms |
コード長 | 381 bytes |
コンパイル時間 | 812 ms |
コンパイル使用メモリ | 82,492 KB |
実行使用メモリ | 63,136 KB |
最終ジャッジ日時 | 2024-12-17 23:01:19 |
合計ジャッジ時間 | 37,176 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 36 |
ソースコード
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()