import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int y; switch (x <= 100000 ? 1 : x > 100000 && x <= 200000 ? 2 : x > 200000 && x <= 400000 ? 3 : x > 400000 && x <= 600000 ? 4 : x > 600000 && x <= 1000000 ? 5 : x > 1000000 ? 6 : 7) { case 1: y = x / 10; System.out.println(y); break; case 2: y = 10000 + (x - 100000) * 75 / 1000; System.out.println(y); break; case 3: y = 17500 + (x - 200000) * 5 / 100; System.out.println(y); break; case 4: y = 37500 + (x - 400000) * 3 / 100; System.out.println(y); break; case 5: y = 43500 + (x - 600000) * 15 / 1000; System.out.println(y); break; case 6: y = 49500 + (x - 1000000) * 1 / 100; System.out.println(y); break; } } } |
Double click to view unformatted code.