結果

問題 No.1009 面積の求め方
ユーザー kyo1
提出日時 2020-09-01 06:32:27
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 397 bytes
コンパイル時間 2,334 ms
コンパイル使用メモリ 191,844 KB
最終ジャッジ日時 2025-01-14 02:52:11
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  double a, b;
  cin >> a >> b;
  auto f = [a, b](double x) { return (x - a) * (x - b); };
  int N = 1000000;
  double res = 0;
  for (double x = a; x < b; x += abs(b - a) / N) {
    res += (b - a) / N * abs(f(x));
  }
  cout << fixed << setprecision(10) << res << '\n';
  return 0;
}
0