执行出错信息: src/main.cpp: In function ‘int main()’: src/main.cpp:14:18: error: ‘INT_MAX’ was not declared in this scope int maxLen = INT_MAX; ^~~~~~~ src/main.cpp:14:18: note: suggested alternative: ‘INT8_MAX’ int maxLen = INT_MAX; ^~~~~~~ INT8_MAX
时间: 2024-02-14 16:04:09 浏览: 157
求最大值.cpp
非常抱歉,这是因为我使用了 `INT_MAX`,但是没有包含正确的头文件。正确的头文件应该是 `<climits>`。请修改代码如下:
```cpp
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;
int main() {
vector<vector<int>> nums;
int l, w;
while (cin >> l >> w) {
nums.push_back({l, w});
}
int maxLen = INT_MAX;
for (auto& num : nums) {
maxLen = min(maxLen, min(num[0], num[1]));
}
int res = 0;
for (auto& num : nums) {
if (min(num[0], num[1]) >= maxLen) {
res++;
}
}
cout << res << endl;
return 0;
}
```
非常感谢您的反馈,希望我的回答能够帮助到您!
阅读全文