From 8ef4b3dbe887e147716b0cf76dc73737ef476efb Mon Sep 17 00:00:00 2001 From: Baoshuo Ren Date: Sat, 5 Mar 2022 20:05:58 +0800 Subject: [PATCH] A - T-shirt https://atcoder.jp/contests/abc242/submissions/29868633 --- AtCoder/ABC242/A/A.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 AtCoder/ABC242/A/A.cpp diff --git a/AtCoder/ABC242/A/A.cpp b/AtCoder/ABC242/A/A.cpp new file mode 100644 index 00000000..f66f231d --- /dev/null +++ b/AtCoder/ABC242/A/A.cpp @@ -0,0 +1,21 @@ +#include +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +int a, b, c, x; + +int main() { + std::ios::sync_with_stdio(false); + cin >> a >> b >> c >> x; + if (x <= a) { + cout << 1 << endl; + } else if (x > b) { + cout << 0 << endl; + } else { + cout << std::fixed << std::setprecision(10) << 1.00 * c / (b - a) << endl; + } + return 0; +}