提交记录 8668
提交时间 |
评测时间 |
2019-03-03 09:02:10 |
2020-08-01 01:22:55 |
#include<cstdio>
#include<cstring>
using namespace std;
const int N = 10003;
char str1[N], str2[N];
int n, m, a[N], b[N], c[N << 1];
int main(){
scanf("%s%s", str1, str2);
n = strlen(str1); m = strlen(str2);
for(int i = 0;i < n;i ++) a[i] = str1[n - 1 - i] - '0';
for(int i = 0;i < m;i ++) b[i] = str2[m - 1 - i] - '0';
for(int i = 0;i < n;i ++){
int x = 0;
for(int j = 0;j < m;j ++){
c[i + j] += a[i] * b[j] + x;
x = c[i + j] / 10;
c[i + j] %= 10;
}
c[i + m] += x;
}
if(c[n + m - 1]) printf("%d", c[n + m - 1]);
for(int i = n + m - 2;~i;i --)
printf("%d", c[i]);
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 250.067 ms | 208 KB | Accepted | Score: 100 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:28:30 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠