解题思路:
注意事项:
参考代码:
import java.math.BigInteger; import java.util.Scanner; public class C1604 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { F(sc.nextInt()); } sc.close(); } private static void F(int n){ BigInteger sum = BigInteger.ONE; for(int i = 1; i <= n; i++){ sum = sum.multiply(BigInteger.valueOf(i)); } String str = sum.toString(); for(int i = str.length()-1; i >= 0; i--){ if(str.charAt(i) != '0'){ System.out.println(str.charAt(i)); break; } } } }
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题10.7 (C语言代码)scanf后面加个getchar(),收掉回车符,就可以用gets了浏览:1149 |
printf基础练习2 (C语言代码)浏览:567 |
C语言训练-求s=a+aa+aaa+aaaa+aa...a的值 (C语言代码)浏览:1031 |
C语言程序设计教程(第三版)课后习题6.8 (C++代码)浏览:592 |
1124题解浏览:595 |
矩形面积交 (C++代码)浏览:1130 |
Hello, world! (C语言代码)浏览:826 |
DNA (C语言代码)浏览:741 |
程序员的表白 (C语言代码)浏览:598 |
简单的a+b (C语言代码)浏览:541 |