二级题,无脑打印。
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int a = 0, b = 0, c = 0, d = 0, e = 0; int x; int level; for (int i = 0; i < n; i += 1) { x = sc.nextInt(); if (x >= 90) { a ++; } else if (x >= 80 && x < 90) { b ++; } else if (x >= 70 && x < 80) { c ++; } else if (x >= 60 && x < 70) { d ++; } else { e ++; } } level = sc.nextInt(); switch (level) { case 1: System.out.println(a);break; case 2: System.out.println(b);break; case 3: System.out.println(c);break; case 4: System.out.println(d);break; case 5: System.out.println(e);break; } sc.close(); } }
0.0分
2 人评分