高精乘,就是裸的FFT啦……
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#define Rep(i, x, y) for (int i = x; i <= y; i ++)
#define RepE(i, x) for (int i = pos[x]; i; i = g[i].nex)
#define Dwn(i, x, y) for (int i = x; i >= y; i --)
using namespace std;
typedef long long LL;
const int M = 200005;
struct CP {
double x, y;
CP() {}
CP(double x0, double y0) { x = x0, y = y0; }
inline CP operator+ (CP b){ return CP(x + b.x, y + b.y); }
inline CP operator- (CP b){ return CP(x - b.x, y - b.y); }
inline CP operator* (CP b){ return CP(x * b.x - y * b.y, x * b.y + y * b.x); }
} a[M], b[M];
char s1[M], s2[M];
int n, ans[M], l, N;
double PI = M_PI;
void Dft(CP *a, int n, int f) {
for (int i = n >> 1, j = 1, k; j < n - 1; j ++) {
if (i > j) swap(a[i], a[j]);
for (k = n >> 1; k <= i; k >>= 1) i ^= k;
i ^= k;
}
for (int i = 2; i <= n; i <<= 1) {
CP wn(cos(2 * PI / i), f * sin(2 * PI / i));
for (int k = 0; k < n; k += i) {
CP w(1, 0), x, y;
Rep(j, 0, i/2-1) x = a[k+j], y = w * a[k+i/2+j], a[k+j] = x + y, a[k+i/2+j] = x - y, w = w * wn;
}
}
if (f == -1) Rep(i, 0, n-1) a[i].x = (a[i].x / N + 0.5);
}
int main()
{
scanf ("%d%s%s", &n, s1, s2);
for (N = 1, l = 0; N < n; N <<= 1, l ++); N <<= 1, l ++;
Rep(i, 0, n-1) a[i].x = s1[n-i-1] - '0', b[i].x = s2[n-i-1] - '0';
Dft(a, N, 1), Dft(b, N, 1);
Rep(i, 0, N-1) a[i] = a[i] * b[i];
Dft(a, N, -1);
Rep(i, 0, N-1) ans[i] = int(a[i].x);
Rep(i, 0, N-1) ans[i+1] += ans[i] / 10, ans[i] %= 10;
int l = N - 1;
while (l && !ans[l]) l --;
Dwn(i, l, 0) printf ("%d", ans[i]);
puts("");
return 0;
}