From 708f2ebf79347062aa07619b36f80ae07e25d35d Mon Sep 17 00:00:00 2001 From: Hiyabye Date: Sun, 14 Jan 2024 20:20:13 +0900 Subject: [PATCH] Add 22937.cpp --- 22xxx/22937.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 22xxx/22937.cpp diff --git a/22xxx/22937.cpp b/22xxx/22937.cpp new file mode 100644 index 00000000..a8fb8a62 --- /dev/null +++ b/22xxx/22937.cpp @@ -0,0 +1,26 @@ +#include +#include +using namespace std; + +void solve(void) { + string a, b; cin >> a >> b; + + bool sign = (a[0] == '-') ^ (b[0] == '-'); + a = (a[0] == '-') ? a.substr(1, 1) + a.substr(3) : a.substr(0, 1) + a.substr(2); + b = (b[0] == '-') ? b.substr(1, 1) + b.substr(3) : b.substr(0, 1) + b.substr(2); + + string ans = to_string(stoull(a) * stoull(b)); + while (ans.size() < 19) ans = "0" + ans; + ans.insert(ans.size() - 18, "."); + if (sign) ans = "-" + ans; + cout << ans << "\n"; +} + +int main(void) { + ios::sync_with_stdio(false); + cin.tie(nullptr); cout.tie(nullptr); + + int n; cin >> n; + while (n--) solve(); + return 0; +} \ No newline at end of file