Cristiano Magro
2025-10-05 0e284a3b0e031f2c6d59b12112df1a6c3bc5b289
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);
    }
}