Run ID:101295
提交时间:2024-12-14 18:52:09
#include <iostream> #include <vector> int main() { // 读取10个苹果的高度 std::vector<int> apple_heights(10); for (int i = 0; i < 10; ++i) { std::cin >> apple_heights[i]; } // 读取陶陶把手伸直时能够达到的最大高度 int taotao_height; std::cin >> taotao_height; // 板凳的高度 const int stool_height = 30; // 计算陶陶站在板凳上能够达到的最大高度 int max_reach_height = taotao_height + stool_height; // 统计能够摘到的苹果数量 int count = 0; for (int height : apple_heights) { if (height <= max_reach_height) { ++count; } } // 输出能够摘到的苹果数量 std::cout << count << std::endl; return 0; }