結果
| 問題 | No.1009 面積の求め方 |
| コンテスト | |
| ユーザー |
iqueue02
|
| 提出日時 | 2020-03-20 21:29:40 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 486 bytes |
| 記録 | |
| コンパイル時間 | 977 ms |
| コンパイル使用メモリ | 179,300 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-25 17:48:11 |
| 合計ジャッジ時間 | 1,651 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
constexpr int INF = 1e9;
int main(){
double a, b;
cin >> a >> b;
int n = 100000;
double h = (b - a) / n;
double res = 0.0;
for (int i = 0; i < n; i++) {
double x1 = a + i * h, x2 = x1 + h;
res += h / 2.0 * ((x1 - a) * (x1 - b) + (x2 - a) * (x2 - b));
}
printf("%.08f\n", abs(res));
return 0;
}
iqueue02