From dc1f0c4c0096013799416664894c5194dc7e1f52 Mon Sep 17 00:00:00 2001 From: Yuqian Yang Date: Fri, 28 Feb 2025 23:13:39 +0800 Subject: chore(store): move everything to store. --- works/life/chuanzhi-cup/practice-contest/3.cpp | 38 -------------------------- 1 file changed, 38 deletions(-) delete mode 100644 works/life/chuanzhi-cup/practice-contest/3.cpp (limited to 'works/life/chuanzhi-cup/practice-contest/3.cpp') diff --git a/works/life/chuanzhi-cup/practice-contest/3.cpp b/works/life/chuanzhi-cup/practice-contest/3.cpp deleted file mode 100644 index 1f79723..0000000 --- a/works/life/chuanzhi-cup/practice-contest/3.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include -#include -#include -#include -#include - -int main() { - std::string input; - std::getline(std::cin, input); - - std::regex reg(R"aaa((\d+)([GMK]?B)=\?([GMK]?B))aaa"); - std::smatch match; - std::regex_match(input, match, reg); - - std::string original_number_str = match[1].str(); - std::string original_unit = match[2].str(); - std::string target_unit = match[3].str(); - - double original_number = std::stod(original_number_str); - - auto to_ratio = [](const std::string s) -> double { - if (s.size() == 1) - return 1; - if (s[0] == 'G') - return std::pow(2, 30); - if (s[0] == 'M') - return std::pow(2, 20); - return std::pow(2, 10); - }; - - double original_ratio = to_ratio(original_unit); - double target_ratio = to_ratio(target_unit); - - std::cout << std::fixed << std::setprecision(6) - << (original_number * original_ratio / target_ratio); - - return 0; -} -- cgit v1.2.3