为什么运行是对的,却全是WA,求助大佬

P5719 【深基4.例3】分类平均

派大星Magic @ 2021-11-27 17:47:10

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        int number1 = 0,number2 = 0;
        int sum1 = 0;
        int sum2 = 0;
        int k1 = 0;
        int k2 = 0;
        double av1 = 0;
        double av2 = 0;

        Scanner scan = new Scanner(System.in);
        number1 = scan.nextInt();
        number2 = scan.nextInt();
        for (int i = 1;i <= number1; i++){
            if (i%number2 == 0){
                sum1 += i;
                k1++;
            }else {
                sum2 += i;
                k2++;
            }

        }
        av1 = (double) sum1/k1;
        av2 = (double) sum2/k2;
        System.out.format("%.1f",av1);
        System.out.println();
        System.out.format("%.1f",av2);

    }
}

|