这个哪里错了,明明答案没错

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

liangyuefei @ 2016-03-23 16:47:27

#include<stdio.h>
int main()
{
    int apple[10],i,j,length;
    int result=0;
    for(i=0;i<=9;i++)
     scanf("%d",&apple[i]);
    printf("\n");
    scanf("%d",&length);
    for(j=0;j<=9;j++)
    {
      if((length+30)>=apple[j])
        result++;
    }
    printf("%d",result);
    return 0;
}

by icecathy @ 2016-03-23 20:06:54

不用写printf("\n");


by 姚文涛 @ 2016-03-24 15:58:01

<0. http://>


by cn_lemon @ 2016-07-30 10:29:11

同1楼


by lydon @ 2016-10-22 11:42:29

include "cstdio"

include "iostream"

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

by 韩小布2007 @ 2016-10-30 19:51:41

#include<iostream>
#include<cstdio>
using namespace std;
int a[105];
int main(){
    int a[10],s=0,h;
    for(int i=1;i<=9;i++)
    cin>>a[i];
    cin>>h;
    for(int i=0;i<=9;i++)
    if(h+30>=a[i]) s++;
    cout<<s<<endl;
    return 0;
}

|