結果

問題 No.1009 面積の求め方
ユーザー minus9dminus9d
提出日時 2020-03-20 21:25:59
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 1,283 bytes
コンパイル時間 736 ms
コンパイル使用メモリ 92,784 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-21 15:00:37
合計ジャッジ時間 1,995 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
4,380 KB
testcase_01 AC 18 ms
4,376 KB
testcase_02 AC 18 ms
4,380 KB
testcase_03 AC 18 ms
4,376 KB
testcase_04 AC 18 ms
4,380 KB
testcase_05 AC 18 ms
4,380 KB
testcase_06 AC 18 ms
4,376 KB
testcase_07 AC 18 ms
4,380 KB
testcase_08 AC 18 ms
4,376 KB
testcase_09 AC 18 ms
4,376 KB
testcase_10 AC 18 ms
4,380 KB
testcase_11 AC 18 ms
4,376 KB
testcase_12 AC 18 ms
4,376 KB
testcase_13 AC 17 ms
4,376 KB
testcase_14 AC 18 ms
4,380 KB
testcase_15 AC 18 ms
4,376 KB
testcase_16 AC 18 ms
4,376 KB
testcase_17 AC 18 ms
4,376 KB
testcase_18 AC 18 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <array>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b; return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b; return true;
    }
    return false;
}
#define pb push_back
#define mp make_pair
#define mt make_tuple

int main(void)
{
    cin.sync_with_stdio(false);
    int a, b;
    cin >> a >> b;

    int mx = 1e7;
    double step = (double)(b - a) / mx;
    double ans = 0.0;
    REP(i, mx) {
        double x = a + step * i;
        double y = (x - a) * (x - b);
        // cout << "x, y = " << x << "," << y << endl;
        ans += y * step;
    }
    cout << fixed << setprecision(20) << abs(ans) << endl;

    return 0;
}
0