From 25ea85b341e6e455e7d8c4e5cba647044feeb094 Mon Sep 17 00:00:00 2001 From: Hiyabye Date: Wed, 7 Feb 2024 01:55:06 +0900 Subject: [PATCH] Add 14623.cpp --- 14xxx/14623.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 14xxx/14623.cpp diff --git a/14xxx/14623.cpp b/14xxx/14623.cpp new file mode 100644 index 00000000..f2f3d0a2 --- /dev/null +++ b/14xxx/14623.cpp @@ -0,0 +1,30 @@ +#include +#include +using namespace std; + +long long bin2dec(string b) { + long long ret = 0; + for (char c : b) ret = 2 * ret + (c - '0'); + return ret; +} + +string dec2bin(long long d) { + string ret = ""; + while (d > 0) ret = to_string(d & 1) + ret, d >>= 1; + return ret; +} + +void solve(void) { + string b1; cin >> b1; + string b2; cin >> b2; + + cout << dec2bin(bin2dec(b1) * bin2dec(b2)); +} + +int main(void) { + ios::sync_with_stdio(false); + cin.tie(nullptr); + + solve(); + return 0; +} \ No newline at end of file