結果
問題 | No.1118 sin(x)/xの二乗和 |
ユーザー |
|
提出日時 | 2019-09-21 05:36:36 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 21 ms / 2,000 ms |
コード長 | 370 bytes |
コンパイル時間 | 775 ms |
コンパイル使用メモリ | 72,724 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-16 05:12:56 |
合計ジャッジ時間 | 1,880 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 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; std::cin>>x; for (int i=0;i<n;++i) ans+=f(i+x); ans+=1/(2*(x+n+0.5)); printf("%.20f\n", ans); }