mihongyu123456 @ 2024-04-09 19:59:43
大佬0分帮蒟蒻看一下
#include <bits/stdc++.h>
using namespace std;
int main() {
double a , b;
cin >> a >> b;
cout << a + b << endl;
return 0;
}
by Salt_conch @ 2024-04-09 20:09:29
不是算乘积吗
by UnknownPeople @ 2024-04-09 20:15:58
还有,这道题要用高精度
by mihongyu123456 @ 2024-04-09 20:41:33
@songyuxuan090318 我不会
by UnknownPeople @ 2024-04-09 20:56:53
@mihongyu123456 不会就去学吖,可以看看题解
by mihongyu123456 @ 2024-04-09 21:02:11
@songyuxuan090318 我们老师不让看
by UnknownPeople @ 2024-04-09 21:08:22
@mihongyu123456 然后他还让你做?
by UnknownPeople @ 2024-04-09 21:08:33
@songyuxuan090318 他没讲吗?
by mihongyu123456 @ 2024-04-09 21:14:25
我在刷题(有些老师没讲)
by chenbingjie @ 2024-04-14 19:55:43
@mihongyu123456 真牛逼.没讲别乱```cpp
using namespace std; int r[2010],l[2010],s[5000]; int main(){ string a,b; cin>>a>>b; reverse(a.begin(),a.end()); reverse(b.begin(),b.end()); string ans=""; int t1=a.size(),t2=b.size(); for(int i=0;i<t1;i++){ r[i+1]=(int)(a[i]-'0'); } for(int i=0;i<t2;i++){ l[i+1]=(int)(b[i]-'0'); } int q=0; for(int i=1;i<=t1;i++){ for(int j=1;j<=t2;j++){ s[j+q]=s[j+q]+r[i]*l[j];
}
for(int k=1;k<=t2+q;k++){
if(s[k]>9){
s[k+1]=s[k+1]+s[k]/10;
s[k]%=10;
}
}
q++;
}
int uuu=1;
if(r[t1]*l[t2]>9)uuu=0;
for(int i=min(t1,t2)+q-uuu;i>=1;i--){
cout<<s[i];
}
return 0;
}
作
by chenbingjie @ 2024-04-14 19:56:43
@mihongyu123456 不小心卡BUG了```
using namespace std; int r[2010],l[2010],s[5000]; int main(){ string a,b; cin>>a>>b; reverse(a.begin(),a.end()); reverse(b.begin(),b.end()); string ans=""; int t1=a.size(),t2=b.size(); for(int i=0;i<t1;i++){ r[i+1]=(int)(a[i]-'0'); } for(int i=0;i<t2;i++){ l[i+1]=(int)(b[i]-'0'); } int q=0; for(int i=1;i<=t1;i++){ for(int j=1;j<=t2;j++){ s[j+q]=s[j+q]+r[i]*l[j];
}
for(int k=1;k<=t2+q;k++){
if(s[k]>9){
s[k+1]=s[k+1]+s[k]/10;
s[k]%=10;
}
}
q++;
}
int uuu=1;
if(r[t1]*l[t2]>9)uuu=0;
for(int i=min(t1,t2)+q-uuu;i>=1;i--){
cout<<s[i];
}
return 0;
}