当前位置:网站首页>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/
边栏推荐
- 华为无线设备STA黑白名单配置命令
- What has become a difficult problem for most people to change careers, so why do many people study software testing?
- 线代(矩阵‘)
- QT learning diary 20 - aircraft war project
- UXDB怎么从日期值中提取时分秒?
- 【论文笔记】Next-ViT: Next Generation Vision Transformer for Efficient Deployment in Realistic Industrial
- [paper notes] effective CNN architecture design guided by visualization
- 用一个栈实现另一个栈的排序
- 【Unity入门计划】基本概念-GameObject&Components
- How to do a good job in safety development?
猜你喜欢

Oracle19 adopts automatic memory management. The AWR report shows that the settings of SGA and PGA are too small?

Robot framework mobile terminal Automation Test ----- 01 environment installation

【Unity入门计划】界面介绍(2)-Games视图&Hierarchy&Project&Inspector
![[unity introduction program] basic concept - preform prefab](/img/c6/aac7bffdf99073978f9b2f8ff15fbb.png)
[unity introduction program] basic concept - preform prefab

Introduction to cesium

nanodet训练时出现问题:ModuleNotFoundError: No module named ‘nanodet‘的解决方法

Day by day, month by month | Shenzhen potential technology released the extreme accelerated version of molecular docking engine uni docking
![[unity entry program] basic concept trigger](/img/16/cd0f8ae579627fc095935195136729.png)
[unity entry program] basic concept trigger

【Unity入门计划】基本概念-预制件 Prefab

diagramscene工程难点分析
随机推荐
【程序员2公务员】三、资源搜集
深度学习之快速实现数据集增强的方法
[unity introduction program] basic concepts - 2D collider collider 2D
How to do a good job in safety development?
Introduction to Manhattan distance
Configuring WAPI certificate security policy for Huawei wireless devices
Servlet常用类剖析
【程序员2公务员】一、基本认知
Problems in deep learning training and testing: error: the following arguments are required: --dataroot, solution: the configuration method of training files and test files
Analysis of common classes of Servlet
Tunnel broadcasting and wireless trunking communication broadcasting system - the case of Tiantaishan tunnel
Summer Challenge harmonyos - slider slider for custom components
【Unity入门计划】基本概念-2D碰撞体Collider 2D
If Debian infringes the rust trademark, will it be exempted by compromising and renaming?
Line generation (matrix ')
【Unity入门计划】界面介绍(2)-Games视图&Hierarchy&Project&Inspector
大佬秋招面经
用一个栈实现另一个栈的排序
Problems during nanodet training: modulenotfounderror: no module named 'nanodet' solution
UXDB怎么从日期值中提取时分秒?