結果

問題 No.1118 sin(x)/xの二乗和
ユーザー 37zigen37zigen
提出日時 2019-09-21 05:40:28
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 349 bytes
コンパイル時間 531 ms
コンパイル使用メモリ 72,756 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-16 05:17:24
合計ジャッジ時間 36,802 ms
ジャッジサーバーID
(参考情報)
judge1 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#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)1e8;
  double x=0;
  std::cin>>x;
  for (int i=0;i<=n;++i) ans+=f(i+x);
  printf("%.20f\n", ans);
}
0