【NOIP2005】【Luogu1046】陶陶摘苹果

problem

  • 给你10个数和一个h
  • 如果h+30>=a[i],答案就累加1

solution

  • 直接模拟
  • 当然你也可以splay

codes

#include<iostream>
using namespace std;
int a[10], h, ans;
int main(){
    for(int i = 0; i < 10; i++)cin>>a[i];  cin>>h;
    for(int i = 0; i < 10; i++)if(h+30 >= a[i])ans++;
    cout<<ans;
    return 0;
}
posted @ 2018-06-07 14:49  gwj1139177410  阅读(119)  评论(0编辑  收藏  举报
选择