大佬们 哪错了

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

NULL11 @ 2022-01-01 15:08:40

#include<bits/stdc++.h>
using namespace std;

int b,a[10],sum=0;
int main(){

    for(int i= 1; i<=10;i++) cin>>a[i];
    cin>>b;
    int tep=b+30;
    for(int i= 1; i<=10;i++){
        if(tep>=a[i]) sum++;
    }
    cout<<sum;
    return 0;

}

by qwq___qaq @ 2022-01-01 15:11:42

@NULL11 数组小了


by REAL_曼巴 @ 2022-01-01 15:15:15

@NULL11 因为输入的数据太多,数组小存不下啊


by batmanzhan @ 2022-01-19 17:30:41

1起点数组至少a[11]


by batmanzhan @ 2022-01-19 17:31:41

@NULL11,数据大,数组放不下


by Switch_1024 @ 2022-02-16 18:55:06

数组再开大


by czk111 @ 2022-02-19 21:55:41

数组应该多开几个,我平时做题时都是多开个十几个的


by Hp_1919810 @ 2022-06-12 18:26:30

#include<bits/stdc++.h>
using namespace std;

int b,a[20],sum=0;
int main(){

    for(int i= 1; i<=10;i++) cin>>a[i];
    cin>>b;
    int tep=b+30;
    for(int i= 1; i<=10;i++){
        if(tep>=a[i]) sum++;
    }
    cout<<sum;
    return 0;

}

|