99我

P1046 [NOIP2005 普及组] 陶陶摘苹果

xuyangming @ 2024-07-28 13:12:56

#include <iostream>
using namespace std;
int a[105];
int main()
{
    int h,s;
    for(int i=0;i<10;i++)
    {
        cin >> a[i];
        cin >> h;
        h+=30;
    }
    for(int i=0;i<10;i++)
    {
        s+=!(h<a[i]);
    }
    cout << s;
}

by xuyangming @ 2024-07-28 13:14:35

赏一个关注


by haimingbei @ 2024-07-28 13:25:10

@xuyangming (AC,求关)

#include <iostream>
using namespace std;
int a[105];
int main()
{
    int h,s=0;
    for(int i=0;i<10;i++)
    {
        cin >> a[i];
    }
    cin >> h;
    h += 30;
    for(int i=0;i<10;i++)
    {
        s+=!(h<a[i]);
    }
    cout << s;
}

by Jayden_121 @ 2024-07-28 13:52:47

数组不用那么大(求关)

#include <bits/stdc++.h>
using namespace std;
int a[11];
int main(){
    int x,ans=0;
    for(int i=1;i<=10;i++){
        cin>>a[i];
    }
    cin>>x;
    for(int i=1;i<=10;i++){
        if(x+30>=a[i]){
            ans ++; 
        }
    }
    cout<<ans;
    return 0;
}

by wa_wa_wa_wa @ 2024-07-31 14:43:04

@xuyangming

1.你h输入了10次

2.s得赋值为0


by xyw1212 @ 2024-12-23 15:34:47

#include <iostream>
using namespace std;
int a[105];
int main()
{
    int h,s=0;
    for(int i=0;i<10;i++){
        cin >> a[i];
    }
    for(int i=0;i<10;i++){
        s+=!(h<a[i]);
    }
    cout << s;
}

已修改


|