当前位置:网站首页>P1046 [noip2005 popularity group t1] Taotao picking apples
P1046 [noip2005 popularity group t1] Taotao picking apples
2022-07-25 07:40:00 【hnjzsyjyj】
【 Title source 】
https://www.luogu.com.cn/problem/P1046
https://www.acwing.com/problem/content/423/
【 Title Description 】
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 format 】
The input consists of 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 format 】
The output includes a line , This line contains only one integer , The number of apples that pottery can pick .
【 Algorithm code 】
#include <bits/stdc++.h>
using namespace std;
int main() {
int a[10];
for (int i=0; i<10; i++) cin>>a[i];
int height;
cin>>height;
height+=30;
int ans=0;
for(int i=0; i<10; i++) {
if(a[i]<=height) ans++;
}
cout<<ans<<endl;
return 0;
}
/*
in:
100 200 150 140 129 134 167 198 200 111
110
out:
5
*/
【 reference 】
https://www.acwing.com/solution/content/3095/
边栏推荐
- The application of for loop and if judgment statement
- [paper notes] effective CNN architecture design guided by visualization
- New version 8.6 SEO quick release system (can be built at source level)
- If Debian infringes the rust trademark, will it be exempted by compromising and renaming?
- 【Unity入门计划】制作我的第一个小游戏
- Acnet: asymmetric convolution for image hypersegmentation (with implementation code)
- MathWorks has been in China for 15 years. What are the secrets of continuous innovation?
- Elasticserach里delete_by_query的机制是什么?
- Hikaricp connection pool does not operate for a period of time, and the data is automatically disconnected
- 华为无线设备配置WAPI-证书安全策略
猜你喜欢

RPC communication principle and project technology selection
![[dynamic programming] - Knapsack model](/img/0d/c467e70457495f130ec217660cbea7.png)
[dynamic programming] - Knapsack model

Native form submission data

Use cyclegan to train self-made data sets, popular tutorials, and get started quickly

【Unity入门计划】界面介绍(1)-Scene视图

Nano data, football data, football match scores, sports data API, Qatar world cup
![[paper notes] progressive layered extraction (PLE): a novel multi task learning (MTL) model for personalized](/img/a8/c5d14ec5f4a22f7925c6d7454b5a58.png)
[paper notes] progressive layered extraction (PLE): a novel multi task learning (MTL) model for personalized
![[paper notes] next vit: next generation vision transformer for efficient deployment in real industry](/img/ea/56881999a90f9c65f5f8768f9574bd.png)
[paper notes] next vit: next generation vision transformer for efficient deployment in real industry
P1086 [NOIP2004 普及组第二题] 花生采摘

Completely replace the redis+ database architecture, and JD 618 is stable!
随机推荐
New version 8.6 SEO quick release system (can be built at source level)
On the peak night of the 8 Oracle ace gathering, what technology hotspots did you talk about?
DJI内推码(一码一用,限时内推)
Matlab self programming series (1) -- angular distribution function
Learn no when playing 9 | enterprise knowledge management is so simple because it uses
About --skip networking in gbase 8A
MATLAB自编程系列(1)---角分布函数
Oracle19 adopts automatic memory management. The AWR report shows that the settings of SGA and PGA are too small?
深度学习训练和测试时出现问题:error: the following arguments are required: --dataroot,解决:训练文件的配置方法和测试文件的配置方法
【程序员2公务员】四、常见问题
Today in history: Intel was founded; The first photo was posted on the world wide web; EBay spins off PayPal
华为无线设备配置WPA2-802.1X-AES安全策略
Polling, interrupt, DMA and channel
J1 common DOS commands (P25)
Common cross domain scenarios
【Unity入门计划】界面介绍(1)-Scene视图
How to use kotlin flow in Android projects
Analysis of common classes of Servlet
CSDN custom T-shirts are waiting for you to get, and the benefits of new programmer are coming!
How should enterprise users choose aiops or APM?