結果
| 問題 |
No.1009 面積の求め方
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-27 09:34:28 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 421 bytes |
| コンパイル時間 | 4,377 ms |
| コンパイル使用メモリ | 250,708 KB |
| 最終ジャッジ日時 | 2025-02-20 13:59:39 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ld = long double;
int a, b, N = 1000000;
double sum, pos;
int main() {
cin >> a >> b;
for (int i = 0; i < N; i++) {
pos = (double)a + (double)(b - a) / N * i;
sum += abs((pos - a) * (pos - b)) * (double)(b - a) / N;
}
cout << fixed << setprecision(15) << sum << endl;
return 0;
}