995!差一点,找不到问题

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

ZXH2012 @ 2024-08-28 16:12:43

救命,还差一点(个人技术烂( ̄▽ ̄)/) 有木有大佬???```cpp

include <bits/stdc++.h>

using namespace std ; int main() { int a[10 + 5] ; int b , num = 0 ; for ( int i = 0 ; i < 10 ; i++ ) { cin >> a[i] ; } cin >> b ; for ( int i = 0 ; i < 10 ; i++ ) { if ( b+30 >= a[i] ) num += 1 ; else num = num ; } cout << num << endl ;

return 0 ;

}


by ZXH2012 @ 2024-08-28 16:13:43

自闭了,代码为啥乱了?


by ZXH2012 @ 2024-08-28 16:14:30

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

by ZXH2012 @ 2024-08-28 16:15:19

重发后的代码


by YiX01 @ 2024-08-28 16:20:15

@ZXH2012 ?所以问题在哪?


by adsd45666 @ 2024-08-28 16:22:43

这不是AC了吗


by ZXH2012 @ 2024-08-31 07:50:37

所以为啥就我的有一个WA了???


by jr001 @ 2024-09-24 16:32:19

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

求关(—#—)


|