为什么是WA 0分?

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

yyy1234 @ 2019-10-27 20:31:56

include <stdio.h>

int main() { int a[10],h,H,k=0,i,n; for(i=0;i<=9;i++) { scanf("%d",&a[i]); } scanf("%d",&h); H=h+30; for(n=0;n<=9;n++) { if(a[n]<=H) { k=k+1; } } return 0; }


by whc2020 @ 2019-10-27 20:35:24

你需要一个输出


by whc2020 @ 2019-10-27 20:36:17

#include <stdio.h>
int main()
{ int a[10],h,H,k=0,i,n;
for(i=0;i<=9;i++) 
{ scanf("%d",&a[i]); }
scanf("%d",&h);
H=h+30;
for(n=0;n<=9;n++)
{ if(a[n]<=H) { k=k+1; } }
printf ("%d" , k); 
return 0; } 

by guoyu @ 2019-10-28 20:55:24

@yyy1234


by guoyu @ 2019-10-28 20:56:37

@whc2019 可以用万能头文件


by guoyu @ 2019-10-28 20:57:01

简单些


by yyy1234 @ 2019-10-29 08:12:41

@guoyu 是什么文件?


by TJR2009 @ 2019-11-07 21:47:16

@yyy1234 万能头是#include<bits/stdc++.h>


by little_Aiz @ 2019-11-15 21:56:18

最好不要用<bits/stdc++.h>,一个一个头文件加比较好有些比赛是不允许用万能投的


by kr1581193849 @ 2020-02-21 16:11:17

#include<bits/stdc++.h>
using namespace std;
int a[101],h,i,s=0;
int main()
{
    int n=10;
    for(i=1;i<=n;i++)
    scanf("%d",&a[i]);
    scanf("%d",&h);
    h=h+30;
    for(i=1;i<=n;i++)
    if(h>=a[i]) s++;
    printf("%d\n",s);
    return 0;
}

|