[2005年NOIP普及组] 陶陶摘苹果

可以把陶陶的身高加上椅子的高度看做陶陶的总身高,只要果子的高度<=陶陶的身高,就说明他可以摘到苹果。

#include<iostream>
using namespace std;
int tree[10];
int main()
{
int t=0;
int height;
for(int i=0;i<10;i++)
cin>>tree[i];
cin>>height;
for(int i=0;i<10;i++)
{
if(tree[i]<=height+30)
t++;
}
cout<<t<<endl;
return 0;
}

posted @ 2022-08-13 10:01  zjtofficial  阅读(31)  评论(0编辑  收藏  举报