Skip to content

Commit

Permalink
Add 14623.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiyabye committed Feb 6, 2024
1 parent 2df18cd commit 25ea85b
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions 14xxx/14623.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include <iostream>
#include <string>
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;
}

0 comments on commit 25ea85b

Please sign in to comment.