freakflowey98 @ 2020-08-18 16:48:13
#include<iostream>
#include<string>
string num1;
string num2;
int data1[1000]={0};
int data2[1000]={0};
int ans[2000]={0};
using namespace std;
int main() {
cin>>num1;
cin>>num2;
int len1=num1.length();
int len2=num2.length();
for (int i=0;i<len1;i++) data1[i]=num1[len1-1-i]-'0';
for (int i=0;i<len2;i++) data2[i]=num2[len2-1-i]-'0';
int carry=0;
for (int i=0;i<len1;i++) {
carry=0;
for (int j=0;j<len2;j++) {
// 重点: i + j
ans[i+j]+=data1[i]*data2[j]+carry;
carry=ans[i+j]/10;
ans[i+j]%=10;
}
// 每一遍循环之后的进位
ans[i+len2]+=carry;
}
int index =len1+len2;
// 去掉前面多余的0
while (index>0&&ans[index]==0) index--;
for (int i=index;i>=0;i--)
cout<<ans[i];
return 0;
}
by JRzyh @ 2020-08-18 16:50:14
using namespace std;
啊啊啊啊啊不是都说了吗啊啊啊啊啊
by ItzPigeon @ 2020-08-18 16:50:41
这using namespace 妙 啊
by wxwoo @ 2020-08-18 16:52:17
主页双贴危
by zyc_ @ 2020-08-18 16:52:22
这 using namespace 妙 啊
by freakflowey98 @ 2020-08-18 16:53:10
为啥usingnamespace不行?还有为什么我不用下划线他就说我滥用标题行?
by hanyuchen2019 @ 2020-08-18 16:55:08
@freakflowey98 我曾经即为这个BUG调了一下午555
by JRzyh @ 2020-08-18 16:55:30
@freakflowey98 换位置
by kradcigam @ 2020-08-18 16:55:46
@freakflowey98
#include<iostream>
#include<string>
using namespace std;
string num1;
string num2;
int data1[1000]={0};
int data2[1000]={0};
int ans[2000]={0};
int main() {
cin>>num1;
cin>>num2;
int len1=num1.length();
int len2=num2.length();
for (int i=0;i<len1;i++) data1[i]=num1[len1-1-i]-'0';
for (int i=0;i<len2;i++) data2[i]=num2[len2-1-i]-'0';
int carry=0;
for (int i=0;i<len1;i++) {
carry=0;
for (int j=0;j<len2;j++) {
// 重点: i + j
ans[i+j]+=data1[i]*data2[j]+carry;
carry=ans[i+j]/10;
ans[i+j]%=10;
}
// 每一遍循环之后的进位
ans[i+len2]+=carry;
}
int index =len1+len2;
// 去掉前面多余的0
while (index>0&&ans[index]==0) index--;
for (int i=index;i>=0;i--)
cout<<ans[i];
return 0;
}
by xyf007 @ 2020-08-18 16:55:50
这
using namespace
妙 啊
by hanyuchen2019 @ 2020-08-18 16:55:51
#include<iostream>
#include<string>
using namespace std;//OK~
string num1;
string num2;
int data1[1000]={0};
int data2[1000]={0};
int ans[2000]={0};