I am attempting to solve https://vjudge.net/problem/UVA-10106 which is a problem where you need to multiply two big numbers.
The code shows the correct answer when run on my computer but the online judge gives "wrong answer".
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
string a, b;
cin >> a >> b;
vector<int> c, d;
for (int i = a.size() - 1; i >= 0; i--) {
int z = a[i] - 48;
c.push_back(z);
}
for (int i = b.size() - 1; i >= 0; i--) {
int x = b[i] - 48;
d.push_back(x);
}
if (c.size() > d.size()) {
c.swap(d);
}
int l = c.size() + d.size();
vector<int> s(l, 0);
int carry = 0, sum = 0;
for (int i = 0; i < c.size(); i++) {
int t;
for (int j = 0; j < d.size(); j++) {
sum = c[i] * d[j] + carry + s[i + j];
carry = sum / 10;
s[i + j] = sum % 10;
t = i + j;
sum = 0;
}
if (carry != 0) {
s[t + 1] = carry;
carry = 0;
}
}
for (int i = l - 1; i >= 0; i--) {
if (s[i] != 0) {
break;
}
else {
l--;
}
}
for (int i = l - 1; i >= 0; i--) {
cout << s[i];
}
}