Skip to content

Commit

Permalink
Add 22937.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiyabye committed Jan 14, 2024
1 parent 27889f8 commit 708f2eb
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions 22xxx/22937.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <iostream>
#include <string>
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;
}

0 comments on commit 708f2eb

Please sign in to comment.