結果

問題 No.2971 無理積分
ユーザー SSRS
提出日時 2024-11-29 21:35:27
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 82 ms / 1,000 ms
コード長 384 bytes
コンパイル時間 2,107 ms
コンパイル使用メモリ 196,556 KB
最終ジャッジ日時 2025-02-26 09:14:01
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  cout << fixed << setprecision(20);
  int N;
  cin >> N;
  int M = 1000000;
  vector<double> y(M + 1);
  for (int i = 0; i <= M; i++){
    double x = (double) i / M;
    y[i] = sqrt(pow(x, 3) + pow(N, 3));
  }
  double ans = 0;
  for (int i = 0; i < M; i++){
    ans += (y[i] + y[i + 1]) / 2 / M;
  }
  cout << ans << endl;
}
0