Untitled
unknown
java
a year ago
424 B
9
Indexable
import java.util.Scanner;
public class P1 {
public static float Sol(int n, int x) {
float s = 0;
int giaithua = 1;
for (int i = 1; i <= n; i++) {
giaithua *= i;
s += Math.pow(x * 1.0, i) / 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