酷代码 AI
菜单
服务商
DeepSeek字节豆包讯飞星火
更多选项

C++编程解决小核桃扫描通道未扫描区域问题

```cpp #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; // 初始化一个长度为11的布尔数组,用于标记每个区域是否被扫描,索引0不使用 vector<bool> scanned(11, false); for (int i = 0; i < n; i++) { int x, y; cin >> x >> y; // 将扫描区域内的标记置为true for (int j = x; j <= y; j++) { scanned[j] = true; } } bool first = true; // 遍历所有区域,输出未被扫描的区域 for (int i = 1; i <= 10; i++) { if (!scanned[i]) { if (!first) { cout << " "; } cout << i; first = false; } } cout << endl; return 0; } ``` ######[AI问答 | 262点数解答 | 2026-04-25 19:11:25]

相关提问
本站限时免费提问中
实用工具查看更多
Linux在线手册 [开发类]
Jquery在线手册 [开发类]
今日油价 [生活类]
图片互转base64 [开发类]
时间转换器 [开发类]