You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
543 B

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int a[N], al;
void mul(int a[], int &al, int b) {
int t = 0;
for (int i = 1; i <= al; i++) {
t += a[i] * b;
a[i] = t % 10;
t /= 10;
}
if (t) a[++al] = t;
while (al > 1 && a[al] == 0) al--;
}
int main() {
string x;
int y;
cin >> x >> y;
for (int i = x.size() - 1; i >= 0; i--) a[++al] = x[i] - '0';
mul(a, al, y);
for (int i = al; i; i--) printf("%d", a[i]);
return 0;
}