Submission #29871113
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
std::vector<std::string> split(const std::string& text, const char delim);
using ll = long long int;
using llu = unsigned long long int;
int main(){
string buffer;
getline(cin, buffer);
const auto& split_item = split(buffer, ' ');
const int A = stoi(split_item[0]);
const int B = stoi(split_item[1]);
const int C = stoi(split_item[2]);
const int X = stoi(split_item[3]);
if (X <= A) {
printf("%.10f", 1.0);
return 0;
}
if (B < X) {
printf("%.10f", 0.0);
return 0;
}
printf("%.10f", static_cast<double>(C) / (B - A));
return 0;
}
std::vector<std::string> split(const std::string& text, const char delim) {
std::vector<std::string> item_list;
std::stringstream ss(text);
std::string buffer;
while ( std::getline(ss, buffer, delim) ) {
if (!buffer.empty()) {
item_list.emplace_back(buffer);
}
}
return item_list;
}
Submission Info
| Submission Time | |
|---|---|
| Task | A - T-shirt |
| User | low10603 |
| Language | C++ (GCC 9.2.1) |
| Score | 100 |
| Code Size | 1101 Byte |
| Status | AC |
| Exec Time | 6 ms |
| Memory | 3768 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 100 / 100 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample_01.txt, sample_02.txt, sample_03.txt |
| All | sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| sample_01.txt | AC | 6 ms | 3612 KiB |
| sample_02.txt | AC | 2 ms | 3732 KiB |
| sample_03.txt | AC | 3 ms | 3632 KiB |
| test_01.txt | AC | 2 ms | 3628 KiB |
| test_02.txt | AC | 2 ms | 3624 KiB |
| test_03.txt | AC | 6 ms | 3616 KiB |
| test_04.txt | AC | 2 ms | 3680 KiB |
| test_05.txt | AC | 2 ms | 3768 KiB |
| test_06.txt | AC | 2 ms | 3768 KiB |
| test_07.txt | AC | 2 ms | 3716 KiB |
| test_08.txt | AC | 2 ms | 3616 KiB |
| test_09.txt | AC | 3 ms | 3756 KiB |
| test_10.txt | AC | 3 ms | 3672 KiB |
| test_11.txt | AC | 2 ms | 3740 KiB |
| test_12.txt | AC | 3 ms | 3632 KiB |
| test_13.txt | AC | 2 ms | 3672 KiB |
| test_14.txt | AC | 2 ms | 3736 KiB |
| test_15.txt | AC | 2 ms | 3736 KiB |