???

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

CHAriSsa0 @ 2021-08-08 11:42:51

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

by Wildcxj @ 2021-08-08 11:45:28

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

    return 0;
}

by WGXWGXWGX @ 2021-08-08 11:45:45

sum没赋初值


by Wildcxj @ 2021-08-08 11:46:00

@茵飒Insaopuml 我的(小学六年级同互关)


by WGXWGXWGX @ 2021-08-08 11:46:16

@茵飒Insaopuml


by HYdroKomide @ 2021-08-08 11:46:18

@茵飒Insaopuml sum要赋初值


|