Cristiano Magro
2025-10-05 12a2fa369bebf06753654ae56d607465419b0553
1
2
3
4
5
6
7
8
9
10
11
12
13
public class GeneralizedHarmonic {
    public static void main(String[] args) {
        int n = Integer.parseInt(args[0]);
        int m = Integer.parseInt(args[1]);
        double sum = 0.0;
 
        for (int i = 1; i <= n; i++) {
            sum += 1.0 / Math.pow(i, m);
        }
 
        System.out.println(sum);
    }
}