A+B problem题解 但是全错误
2025-08-04 18:33:02
发布于:浙江
6阅读
0回复
0点赞
本题解仅供娱乐,认真你就输了!
这题要求我们输出a+b,非常简单 下面是代码:
AC(正确)代码
#include<iostream>
using namespace std;
int a,b;
int main(){
cin>>a>>b;
cout<<a+b;
}
WA(答案错误)代码
#include<iostream>
using namespace std;
int a,b;
int main(){
cin>>a>>b;
cout<<endl<<a+b;//通过在输出答案前输出一个换行使答案错误达成WA
}
TLE(时间超限)代码
#include<iostream>
using namespace std;
int a,b;
long long c;
int main(){
cin>>a>>b;
while(114514){//通过死循环使时间超限
c++;
}
cout<<a+b;
}
OLE(输出超限)代码
#include<iostream>
using namespace std;
int a,b;
int main(){
cin>>a>>b;
for(int i=0;i<10000000;i++){//通过输出10^7个a+b让输出超出限制
cout<<a+b;
}
}
MLE(内存超限)代码
#include<iostream>
#include<vector>
using namespace std;
int a,b;
vector<int> v;
int main(){
cin>>a>>b;
while(114514){//通过无限往v里推114514使内存爆炸
v.push_back(114514);
}
cout<<a+b;
}
RE(运行时错误)代码
#include<iostream>
using namespace std;
int a,b,c[5];
int main(){
cin>>a>>b;
c[100000000000]=114514;//通过数组越界让程序在运行使出错
cout<<a+b;
}
PE(输出格式错误)代码
#include<iostream>
using namespace std;
int a,b;
int main(){
cin>>a>>b;
cout<<" "<<a+b;//通过输出一大堆空格使输出格式错误
}
过不了编译(应该叫CE?)代码
请输入文本//请输入文本
这里空空如也
有帮助,赞一个