CCF201612-2 工资计算(JAVA版)

2020-03-20  本文已影响0人  巨鹿lx
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        if (n <= 3500) {
            System.out.println(n);
        } else {
            for (int i = 3600; i <= 100000; i += 100) {
                int B = 0;
                int A = i - 3500;
                if (A > 80000) {
                    B += (A - 80000) * 0.45;
                }
                if (A > 55000) {
                    B += (Math.min(80000, A) - 55000) * 0.35;
                }
                if (A > 35000) {
                    B += (Math.min(55000, A) - 35000) * 0.30;
                }
                if (A > 9000) {
                    B += (Math.min(35000, A) - 9000) * 0.25;
                }
                if (A > 4500) {
                    B += (Math.min(9000, A) - 4500) * 0.20;
                }
                if (A > 1500) {
                    B += (Math.min(4500, A) - 1500) * 0.10;
                }
                B += Math.min(A, 1500) * 0.03;
                if (B + n == i) {
                    System.out.println(i);
                    return;
                }
            }

        }
    }
}
上一篇下一篇

猜你喜欢

热点阅读