ECNUAT_LZX @ 2024-07-26 10:58:15
违规紫衫QAQ
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
srand(time(0));
int a, b;
cin >> a >> b;
while (1) {
int ans = rand() % (int) (2e9+1);
if (ans == a + b) {
cout << ans;
return 0;
}
}
return 0;
}
by Qinglan2011 @ 2024-07-26 11:00:00
@ECNUAT_LZX 你这rand,用的出神入化
by ECNUAT_LZX @ 2024-07-26 11:01:39
@Qinglan2011 我觉得挺菜的QAQ
by Qinglan2011 @ 2024-07-26 11:02:27
@ECNUAT_LZX 要知道,高精度的圣职可不是rand能够胜任的
by ECNUAT_LZX @ 2024-07-26 11:02:56
@Qinglan2011 ?
by Qinglan2011 @ 2024-07-26 11:03:48
@ECNUAT_LZX 所以用高精度才是最佳选择,会错的很好看
by Qinglan2011 @ 2024-07-26 11:04:43
@ECNUAT_LZX 可惜,题目中说了"不能有多余的内容,这也包括了“请输入整数 a和 b” 这一类的提示用户输入信息的内容。若包含了这些内容,将会被认为是 Wrong Answer,即洛谷上的 WA"
by ECNUAT_LZX @ 2024-07-26 11:04:45
@Qinglan2011 南绷
by Qinglan2011 @ 2024-07-26 11:06:05
@ECNUAT_LZX 这才是最友好
#include<bits/stdc++.h>
using namespace std;
const int maxn = 4*1e3+50;
int a[maxn], b[maxn], ans[maxn];
int main()
{
string s1,s2;
cin>>s1>>s2;
int n = s1.length(), m = s2.length();
for (int i = 0; i < n; i ++) a[i] = s1[n-1-i] - '0';
for (int i = 0; i < m; i ++) b[i] = s2[m-1-i] - '0';
int h = n + m-1;
for (int i = 0; i < n; i ++)
for (int j = 0; j < m; j ++)
{
ans[i+j] += a[i] * b[j];
}
for (int i = 0; i<h; i ++)
{
ans[i+1] += ans[i] / 10;
ans[i] %= 10;
}
while(!ans[h]&&h>=1)h--;
for(int i=h;i>=0;i--)
{
printf("%d",ans[i]);
}
}
的代码
by ECNUAT_LZX @ 2024-07-26 11:07:26
@Qinglan2011 包友好的
by Qinglan2011 @ 2024-07-26 11:08:29
@ECNUAT_LZX 包错的,绝对错的干净利落,五光十色,姹紫嫣红!