結果
問題 |
No.1118 sin(x)/xの二乗和
|
ユーザー |
|
提出日時 | 2019-09-16 14:45:17 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 355 bytes |
コンパイル時間 | 695 ms |
コンパイル使用メモリ | 73,452 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-16 05:13:00 |
合計ジャッジ時間 | 1,869 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 20 |
ソースコード
#include <iostream> #include <string> #include <vector> #include <queue> #include <cmath> double f(double x) { if (abs(x)<1e-9) { return 1; } else { double v=std::sin(x)/x; return v*v; } } int main() { double ans=0; int n=(int)1e6; double x=0; for (int i=0;i<n;++i) ans+=f(i); ans+=1/(2*(x+n+0.5)); printf("%.20f\n", ans); }