Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
117273 成书骏 06买鸡腿 C++ Wrong Answer 0 MS 268 KB 650 2025-04-15 22:27:36

Tests(0/10):


Code:

#include <iostream> int main() { int a, B; std::cout << "请输入每只鸡腿的价格 (元): "; std::cin >> a; std::cout << "请输入小A手中的钱数 (元): "; std::cin >> B; if (a <= 0 || B < 0) { std::cerr << "价格和钱数必须是非负数" << std::endl; return 1; } int totalLegs = B / a; // 计算小A可以购买的鸡腿数量 int freeLegs = totalLegs / 3; // 计算赠送的鸡腿数量 int totalEatenLegs = totalLegs + freeLegs; // 总共能吃到的鸡腿数量 std::cout << "小A能吃到的鸡腿总数: " << totalEatenLegs << std::endl; return 0; }


Run Info:

------Input------
1 98
------Answer-----
130
------Your output-----
请输入每只鸡腿的价格 (元): 请输入小A手中的钱数 (元): 小A能吃到的鸡腿总数: 130