解题思路:
注意事项:
参考代码:
import java.util.Scanner;
public class E1133 {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
long n = sc.nextLong();
long sum = 0;
for (int i = 1; i <= n; i++) {
long b = 1;
long a = 0;
for (int j = 1; j <= i; j++) {
a = b * j;
b = a;
}
sum = sum + a;
}
System.out.println(sum);
}
}
0.0分
0 人评分