派大星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);
}
}