酷代码 AI
菜单
服务商

C++:巨龙交替喷火,求解热量超20的石块编号

```cpp #include <iostream> using namespace std; int main() { int n; cin >> n; int heat1 = 0, heat2 = 0; for (int i = 0; i < n; i++) { int heat; cin >> heat; if (i % 2 == 0) { heat1 += heat; } else { heat2 += heat; } } if (heat1 > 20) { cout << 1 << endl; } if (heat2 > 20) { cout << 2 << endl; } return 0; } ``` ######[AI问答 | 167点数解答 | 2025-11-22 19:11:12]

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