大佬求调

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

houyunjie @ 2024-09-07 17:19:51

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,a[15],c=0;
    for(int i = 0;i < 10;i++){
        cin>>a[i];
    }
    cin>>n;
    for(int i = 0;i < 10;i++){
        if(n>=a[i]){
            c++;
        }
    }
    cout<<c<<endl;
    return 0;
}

by dongzirui0817 @ 2024-09-07 17:22:17

@houyunjie 请认真读题,陶陶还有个 30cm 的凳子垫高。


by pmkmzfuzsotqotmzs @ 2024-09-07 17:24:32

@houyunjie

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

by Nemo0216 @ 2024-09-07 17:46:39

@houyunjie 请认真读题!!!!!

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,a[15],c=0;
    for(int i = 0;i < 10;i++){
        cin>>a[i];
    }
    cin>>n;
    for(int i = 0;i < 10;i++){
        if(n/*这里加一个“+30”就好*/>=a[i]){
            c++;
        }
    }
    cout<<c<<endl;
    return 0;
}

by zhaoyuxi1202 @ 2024-09-08 09:50:34

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

 //读题呀

by _qwqawa_ @ 2024-09-26 20:56:18

凳子呢?


|