結果
問題 | No.1009 面積の求め方 |
ユーザー |
![]() |
提出日時 | 2020-03-20 21:27:28 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 629 bytes |
コンパイル時間 | 1,504 ms |
コンパイル使用メモリ | 167,600 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-15 03:46:13 |
合計ジャッジ時間 | 2,070 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long int; using ull = unsigned long long int; using P = pair<int, int>; using P3 = pair<double,P>; using PP = pair<P, P>; constexpr int INF = 1 << 30; constexpr ll MOD = ll(1e9)+7; constexpr int di[] = {0, 1, 0, -1}; constexpr int dj[] = {1, 0, -1, 0}; constexpr double EPS = 1e-9; double a, b; double f(double x){ return (x-a)*(x-b); } int main(){ cin >> a >> b; int n = 100000; double ans = 0, dx = (b-a)/double(n); for(int i=0;i<n;i++){ double x = a+dx*i; ans += abs(f(x))*dx; } printf("%.6lf\n",ans); return 0; }