解题思路:
注意事项:
参考代码:
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
BigInteger s = new BigInteger("0");
for (int i = 1; i <= n; i++) {
int m = i;
BigInteger x = new BigInteger("1");
while (m > 0) {
BigInteger y = new BigInteger(String.valueOf(m));
x = x.multiply(y);
m--;
}
s = s.add(x);
}
System.out.print(s);
}
}
0.0分
0 人评分
简单的a+b (C语言代码)浏览:720 |
2003年秋浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:629 |
C语言训练-求1+2!+3!+...+N!的和 (C语言代码)浏览:533 |
C语言训练-计算:t=1-1/(2*2)-1/(3*3)-...-1/(m*m) (C语言代码)浏览:780 |
【数组的距离】 (C语言代码)浏览:728 |
C语言训练-大、小写问题 (C语言代码)浏览:611 |
简单的for循环浏览:1408 |
C语言程序设计教程(第三版)课后习题5.8 (C语言代码)浏览:1147 |
1415题求解浏览:605 |
C语言训练-求矩阵的两对角线上的元素之和 (C语言代码)浏览:926 |