我已经写了一个代码来解决codechef中的Buying new tablet问题。尽管在CLION和Visual Studio中一切正常,甚至输出都是正确的,但codechef编译器显示运行时错误SIGTSTP。我是新来这个网站的,看不懂上面写的是什么。我对谷歌做了一些研究,但一无所获。
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
int T,N,B,W,H,P;
bool isGr = false;
cin >> T;
while (T--){
cin >> N;
cin >> B;
vector <int> tablets;
while (N--){
cin >> W;
cin >> H;
cin >> P;
if (P <= B) {
tablets.push_back(W*H);
isGr = true;
}
else isGr = false;
}
if (isGr){
sort(tablets.begin(),tablets.end());
cout << tablets.back() << endl;
tablets = {};
} else cout << "no tablet" << endl;
isGr = false;
}
}发布于 2019-09-15 15:05:40
第二个while循环中的条件‘else isGr=false;’‘不是必需的...
https://stackoverflow.com/questions/57843301
复制相似问题