yaoyao0407 @ 2020-08-18 15:57:53
运行结果没对(用的666666*99999999)
抱着试试的心态上了洛谷,自己挑不出啥毛病,求助
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
using namespace std;
string cmp(string a,string b){
if(a.length()>b.length()){
return a;
}
if(b.length()<a.length()){
return b;
}
int i;
for(i=1;i<=a.length();i++){
if(a[i]>b[i]){
return a;
}
if(b[i]>a[i]){
return b;
}
}
if(i==(a.length()+1)){
return a;
}
}
int main(){
string a,b,c,e,min;
cin>>a>>b;
min=cmp(a,b);
if(min==b){
swap(a,b);
}
for(int i=1;i<=a.length();i++){
c[0]=0;
for(int j=1;j<=b.length();j++){
e[i]=(a[i]*b[j])/10+c[j-1];
c[j]=(a[i]*b[j])%10;
}
}
for(int i=1;i<=e.length();i++){
cout<<e[i];
}
return 0;
}
by konjacq @ 2020-08-18 17:42:22
@yaoyao0407 ? 就是读入完了之后,