当前位置:网站首页>029: Tao Tao picks apples
029: Tao Tao picks apples
2022-07-21 22:38:00 【Long Xingchen】
029: Tao Tao picks apples
Total time limit :
1000ms
Memory limit :
65536kB
describe
There is an apple tree in the Tao Tao's yard , Every autumn the trees will bear 10 An apple . When the apple is ripe , Tao Tao would run to pick apples . Tao Tao has a 30 Centimeter high bench , When she can't pick the apple directly by hand , Will step on the bench and try again .
Now we know 10 The height of an apple to the ground , And the maximum height that can be reached when the handle of pottery is extended , Please help Tao Tao calculate the number of apples she can pick . Suppose she ran into an apple , The apple will fall .
Input
Including two lines of data . The first line contains 10 individual 100 To 200 Between ( Include 100 and 200) The integer of ( In centimeters ) respectively 10 The height of an apple to the ground , Two adjacent integers are separated by a space . The second line only includes one 100 To 120 Between ( contain 100 and 120) The integer of ( In centimeters ), It means the maximum height that can be reached when the handle of pottery is extended .
Output
Including a line , This line contains only one integer , The number of apples that pottery can pick .
The sample input
100 200 150 140 129 134 167 198 200 111 110
Sample output
5
source
NOIP2005 The rematch Popularization group The first question is
We can look at the source , wow ! First question of popularization group , So difficult , But see the year and “ The rematch ” After two words , I don't think so , The current popularity group is much more difficult than the previous popularity Group , So don't make a fuss .
The key to this problem is to judge , We can judge whether the height of each apple is less than or equal to the maximum height of mischief plus 30cm, If so , Add one to the value of a variable , repeat 10 Time , Finally, output this variable , Is the most naughty can pick .
Code :
#include <iostream>
using namespace std;
int main()
{
int a[10];
for(int i=0;i<10;i++)
cin>>a[i];
int b,sum=0;
cin>>b;
for(int i=0;i<10;i++)
if(b+30>=a[i])
sum++;
cout<<sum;
}
Only a short 14 Line code , Come on !
I'll see a lot of questions in the future , Don't panic , We should examine the questions carefully , Maybe the problem is long , The topic is simple ?
边栏推荐
- Source Insight 4.0个性化设置及快捷键
- 堪比“神仙打架”的开源数据可视化社群,你见过吗?
- Explain the principle, classification and function of microphone array in detail
- Online JVM memory problem location
- What are the problems in the classification and future development of IOT devices?
- 一文讲透,分布式系统的数据分片难题
- robotframework--浏览器驱动和操作的实现(1)
- What is a direct drinking machine? What is its working principle and advantages?
- Good looking and interesting data visualization chart making, worship tutorial
- 01 knapsack interview questions series (I)
猜你喜欢
beta.4 版发布啦,国产开源数据可视化 datart 接下来将会小跑进入 rc 阶段
Concurrency opening -- take you from 0 to 1 to build the cornerstone of concurrency knowledge system
火爆社区的开源数据可视化工具 datart 新用户体验教程
datart 自定义插件,不改动源代码,让 BI 顺利完成又一次创新
What are the problems in the classification and future development of IOT devices?
This Bluetooth chip giant aims at the WiFi SOC market and launches a low-power WiFi MCU product line
datart 开源数据可视化应用 | 手把手教你开发出优秀的图表插件
概率论-大数定律和中心极限定理
归并排序
Open source data visualization tool datart new user experience tutorial for popular communities
随机推荐
Characteristics and differences between PCB and integrated circuit
归并排序
Heap - principle to application - heap sorting, priority queue
Yolov4 (Darknet version) post processing: display confidence and save the contents of the detection box locally
西瓜书第二章-比较检验
14. 最长公共前缀
創意編程/小學組(4-6年級)-圖形化創意
What are the problems in the classification and future development of IOT devices?
2022ACM夏季集训周报(三)
卡牌
110. 平衡二叉树
Good looking and interesting data visualization chart making, worship tutorial
企业如何做好数据管理?产品选型怎么做?
Common shortcut keys of robotframework
Source Insight 4.0个性化设置及快捷键
庖丁解牛斐波拉契数列和背包问题——详细解析两个问题优化过程,带你从最基本的问题看懂动态规划!!!
In depth analysis of multiple knapsack problem (Part 2)
What is PCBA? What is the importance of PCBA testing?
用两个模板(递归法和迭代法)完成二叉树的四种遍历方式
Why is Le Xin in a hurry to release esp32-c3 when there are few words