酷代码 AI
菜单
服务商

C++编程:帮开学的小明算一算钱够不够买文具!

```cpp #include <iostream> using namespace std; int main() { int X, Y, Z, Q; cin >> X >> Y >> Z >> Q; int total_cost = 2 * X + 5 * Y + 3 * Z; if (Q >= total_cost) { cout << "Yes" << endl; cout << Q - total_cost << endl; } else { cout << "No" << endl; cout << total_cost - Q << endl; } return 0; } ``` ######[AI问答 | 116点数解答 | 2026-01-19 19:21:40]

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