Submission #30644581
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;
// y = (A / B)x
// d = sqrt(a^2 + b^2)
// 1 : d = xa : A
// xa = A / d
int main(){
string buffer;
getline(cin, buffer);
auto input_list = split(buffer, ' ');
const int A = stoi(input_list[0]);
const int B = stoi(input_list[1]);
const double d = sqrt(pow(A, 2) + pow(B, 2));
cout << A / d << " " << B / d << endl;
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;
const size_t NUM_ITEM = std::count(text.begin(), text.end(), delim);
item_list.reserve(NUM_ITEM + 1);
while ( std::getline(ss, buffer, delim) ) {
if (!buffer.empty()) {
item_list.emplace_back(buffer);
}
}
return item_list;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Get Closer |
| User | low10603 |
| Language | C++ (GCC 9.2.1) |
| Score | 200 |
| Code Size | 1087 Byte |
| Status | AC |
| Exec Time | 7 ms |
| Memory | 3832 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| 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, test_16.txt, test_17.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| sample_01.txt | AC | 7 ms | 3736 KiB |
| sample_02.txt | AC | 3 ms | 3744 KiB |
| sample_03.txt | AC | 2 ms | 3652 KiB |
| test_01.txt | AC | 2 ms | 3768 KiB |
| test_02.txt | AC | 2 ms | 3808 KiB |
| test_03.txt | AC | 2 ms | 3708 KiB |
| test_04.txt | AC | 2 ms | 3600 KiB |
| test_05.txt | AC | 2 ms | 3668 KiB |
| test_06.txt | AC | 2 ms | 3708 KiB |
| test_07.txt | AC | 3 ms | 3812 KiB |
| test_08.txt | AC | 5 ms | 3708 KiB |
| test_09.txt | AC | 2 ms | 3676 KiB |
| test_10.txt | AC | 2 ms | 3832 KiB |
| test_11.txt | AC | 2 ms | 3600 KiB |
| test_12.txt | AC | 2 ms | 3748 KiB |
| test_13.txt | AC | 3 ms | 3672 KiB |
| test_14.txt | AC | 1 ms | 3656 KiB |
| test_15.txt | AC | 2 ms | 3600 KiB |
| test_16.txt | AC | 2 ms | 3712 KiB |
| test_17.txt | AC | 2 ms | 3660 KiB |