Liyaping17 @ 2024-02-01 10:56:32
#include<stdio.h>
int main()
{
int a[10];
int i,hight,n=0;
for(i=0;i<10;i++){
scanf("%d",&a[i]);
}
scanf("%d",&hight);
for(i=0;i<10;i++){
if (a[i]>=hight+30) n++;
else continue;
//printf("i=%d n=%d\n",i,n);
}
printf("%d",n);
return 0;
}
by zkdphy @ 2024-02-01 15:58:17
if (a[i]>=hight+30) n++,这里不应该是<=吗?
by 120229xhj @ 2024-02-16 10:21:07
@Liyaping17
#include<iostream>
using namespace std;
int main()
{
int a[10]={},b,e;
e=0;
for(int i=0;i<10;i++)
{
cin>>a[i];
}
cin>>b;
for(int d=0;d<10;d++)
{
if(b+30>=a[d])/*这里一定注意,之前我也是90,改了就对了*/
{
e++;
}
}
cout<<e;
return 0;
}
by libaishi @ 2024-04-02 21:25:52
#include <bits/stdc++.h>
using namespace std;
int a[20];
int main()
{
for(int i=1;i<=10;i++)
{
cin>>a[i];
}
int n;
cin>>n;
int cnt=0;
for(int i=1;i<=10;i++)
if(n+30>=a[i])
cnt++;
cout<<cnt;
return 0;
}