酷代码 AI
菜单
服务商

人工智能传送一个人需要10点能量,传送人数每多一个要在原来的基础上增加5的能量,现在有n个人,请问传送这n个人一共需要花费多少能量 输入一个整数n,表示人工智能需要传送的人数(n<10)使用c++语言

```cpp #include <iostream> using namespace std; int main() { int n; cin >> n; int totalEnergy = 0; int currentCost = 10; for (int i = 0; i < n; i++) { totalEnergy += currentCost; currentCost += 5; } cout << totalEnergy << endl; return 0; } ``` [2025-12-07 14:17:25 | AI问答 | 90点数解答]

相关提问
发财导航,免费问AI
实用工具查看更多