怎么全是WA啊?大佬帮忙看看吧!

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

luogu3213 @ 2023-06-05 10:33:04


#include <stdio.h>
int a[10],tthh,tt,pickapple=0;
int main() {

    for(register int i=0;i<10;i++)
        scanf("%d\n",&a[i]);
        scanf("%d\n",&tt);
    tthh=tt+30;
    for(register int i=0;i<10;i++){
        if(a[i]<=tthh)
        pickapple++;
    };
    printf("淘淘摘了%d个苹果\n",pickapple);
    return 0;

    }

by Henry2012 @ 2023-06-05 10:34:14

你输出不对


by Henry2012 @ 2023-06-05 10:34:58

printf("%d\n",pickapple);

by luogu3213 @ 2023-06-05 10:40:17

@Henry2012 谢谢


by wwanghaoyu123456 @ 2023-07-24 18:32:21

/简单吧/

#include<iostream>

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

|