Untitled

 avatar
unknown
java
a year ago
388 B
5
Indexable
import java.util.Scanner;

public class P1 {
	public static float Sol(int n) {
		float s = 0;
		int mauso = 0;
		for (int i = 0; i <= n; i++) {
			mauso += i;
			s += 1.0 / mauso;
		}

		return s;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
//		int x = sc.nextInt();
		int n = sc.nextInt();

		System.out.println(Sol(n));
	}
}
Editor is loading...
Leave a Comment