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);
| }
| }
|
|