結果
問題 |
No.1118 sin(x)/xの二乗和
|
ユーザー |
|
提出日時 | 2019-09-21 05:38:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 19 ms / 2,000 ms |
コード長 | 373 bytes |
コンパイル時間 | 751 ms |
コンパイル使用メモリ | 72,976 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-16 05:12:58 |
合計ジャッジ時間 | 1,539 ms |
ジャッジサーバーID (参考情報) |
judge5 / 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=0; 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); }