小蒟蒻10分qwq悬赏关注!

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

alanbecker @ 2023-11-14 21:33:50

#include<iostream>
using namespace std;
int main(){
    int apple[11] = {0};
    int taotao;
    int zbd;
    int s= 0;
    for(int i = 1;i <=  10;i++){
        cin >> apple[i];
    }
    cin >> taotao;
    zbd = taotao + 30;
    for(int i = 1;i <= 10;i++){
        if(zbd < apple[i]){
            s++;
        } 
    }
    cout << s;
    return 0;
} 

by qnqfff @ 2023-11-14 21:37:44

if(zbd < apple[i])

--->

if(zbd >= apple[i])

by alanbecker @ 2023-11-14 22:01:37

谢,奖励已发送


by plj198365 @ 2024-01-14 17:25:13

#include<iostream>
using namespace std;
int main(){
    int a[10],b,c=0; 
    for(int i=0;i<10;i++) 
        cin>>a[i]; 
        cin>>b; 
    for(int k=0;k<10;k++) {
        if(a[k]<=b+30)c++;
    } 
    cout<<c<<endl; 
    return 0; 
}

|