Untitled
unknown
java
9 months ago
481 B
6
Indexable
import java.util.Scanner; public class P1 { public static float Sol(int n, int x) { float s = 1 + x; for (int i = 1; i <= n; i++) { int giaithua = 1; for (int j = 1; j <= 2 * i + 1; j++) { giaithua *= j; } s += Math.pow(x, 2 * i + 1) / giaithua; } 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, x)); } }
Editor is loading...
Leave a Comment