awfguyesfbh @ 2022-11-20 10:53:27
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
int e = 0;
int a[] = new int [10];
for(int i = 0;i <10;i++) {
a[i] = input.nextInt();
System.out.print(" ");
}
int b = input.nextInt();
for(int i = 0; i < a.length;i++) {
if(b + 30 >= a[i]) {
int j = 0; j++;
e += j;
}
}
System.out.println(e);
}
}
by BearBig @ 2022-11-20 11:36:28
@awfguyesfbh 删掉 System.out.print(" ");
by awfguyesfbh @ 2022-11-21 00:36:32
@HeavenGalaxy 好的,谢谢
by zhumoxuan @ 2022-12-20 20:37:08
不用这么难
#include<bits/stdc++.h>
using namespace std;
int a[11],n,ans;
int main(){
for(int i=0;i<10;i++)
cin>>a[i];
cin>>n;
for(int i=0;i<10;i++){
if(a[i]<=(n+30))
ans++;
}
cout<<ans;
return 0;
}