Submission #4352891


Source Code Expand

Copy
#include <bits/stdc++.h>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

using D = long double;

D solve(D h, D a) {
    if (2 * a > h) {
        return solve(2 * (h - a), (h - a)) + (2 * a - h);
    }
    D sm = a * a * a * 2 / 3 + a * a * (h - 2 * a);
    return sm / (h - a) / (h - a);
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << fixed;
    D h, w, a, b;
    cin >> h >> w >> a >> b;

    D s1 = solve(h, a), s2 = solve(w, b);
    cout << s1 * s2 << endl;
    //cout << s1 << " " << s2 << " " << s1 * s2 << endl;
    return 0;
}

Submission Info

Submission Time
Task A - Affiches
User yosupo
Language C++14 (GCC 5.4.1)
Score 500
Code Size 793 Byte
Status
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 01.txt, 02.txt
All 500 / 500 01.txt, 02.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt
Case Name Status Exec Time Memory
01.txt 1 ms 256 KB
02.txt 1 ms 256 KB
10.txt 1 ms 256 KB
11.txt 1 ms 256 KB
12.txt 1 ms 256 KB
13.txt 1 ms 256 KB
14.txt 1 ms 256 KB
15.txt 1 ms 256 KB
16.txt 1 ms 256 KB
17.txt 1 ms 256 KB
18.txt 1 ms 256 KB
19.txt 1 ms 256 KB