17 条题解
-
0
/* 上课1小时02分钟! */ #include #include <math.h> #include #include <stdio.h> #include #include #include #include <string.h> #include using namespace std; #define LL long long const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; int a[N],b[N],c[N]; int main() { string x,y; cin >> x >> y; int lenx = x.size(); int leny = y.size(); for(int i = 0 ; i < lenx ; i++) a[i] = x[lenx - i - 1] - '0'; for(int i = 0 ; i < leny ; i++) b[i] = y[leny - i - 1] - '0'; for(int i = 0 ; i < lenx ; i++) for(int j = 0 ;j < leny ; j++) { c[i+j] += a[i] * b[j]; c[i+j + 1] += c[i+j]/10; c[i+j] %= 10; } int len = lenx + leny ; while( !c[len] && len > 0) len--;
for(int i = len ; i >= 0 ; i--) cout << c[i]; return 0;}
信息
- ID
- 1187
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 6
- 标签
- 递交数
- 1062
- 已通过
- 296
- 上传者