提交记录 19228
提交时间 |
评测时间 |
2023-02-26 15:50:35 |
2023-02-26 15:50:38 |
#include <iostream>
#include <cstdio>
#include <string.h>
#include <sstream>
#include <stdlib.h>
using namespace std;
int main()
{
int n;
int i = 0;
string Sa;
string Sb;
scanf("%d",&n);
string ProblemSetA[n];
string ProblemSetB[n];
stringstream ss;
for(int j = 0;j < n;j++)
{
cin >> ProblemSetA[j];
cin >> ProblemSetB[j];
}
while(i < n)
{
char tmp[4];
Sa = ProblemSetA[i];
Sb = ProblemSetB[i];
int Length_a = (Sa.size()%4 != 0) ? Sa.size()/4 + 1 : Sa.size()/4;
int Length_b = (Sb.size()%4 != 0) ? Sb.size()/4 + 1 : Sb.size()/4;
unsigned int SPa[Length_a];
unsigned int SPb[Length_b];
unsigned long long int Result[Length_a+Length_b+1];
for (int j = 0; j < Length_a+Length_b+4;j++)
{
Result[j] = 0;
}
for (int j = 0;j<Length_a-1;j++)
{
strcpy(tmp,Sa.substr(Sa.size()-(j+1)*4,4).c_str());
SPa[j] = atoi(tmp);
}
strcpy(tmp,Sa.substr(0,Sa.size()-(Length_a-1)*4).c_str());
SPa[Length_a-1] = atoi(tmp);
for (int j = 0;j<Length_b-1;j++)
{
strcpy(tmp,Sb.substr(Sb.size()-(j+1)*4,4).c_str());
SPb[j] = atoi(tmp);
}
strcpy(tmp,Sb.substr(0,Sb.size()-(Length_b-1)*4).c_str());
SPb[Length_b-1] = atoi(tmp);
for(int j = 0;j < Length_a;j++)
{
for(int k = 0;k < Length_b;k++)
{
Result[j+k] += SPa[j]*SPb[k];
}
}
for(int j = 0; j < Length_a+Length_b;j++)
{
Result[j+1] += Result[j] / 10000;
Result[j] = Result[j] % 10000;
}
for(int j = Length_a+Length_b; j >= 0;j--)
{
if(Result[j] != 0)
{
ss << Result[j];
}
}
ss << endl;
i++;
}
cout << ss.str();
return 0;
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 22.991 ms | 319 MB + 36 KB | Runtime Error | Score: 0 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2025-09-15 21:20:08 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠