解题思路:
注意事项:
参考代码:
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语言代码)浏览:1223 |
C语言程序设计教程(第三版)课后习题7.1 (C语言代码)浏览:515 |
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:628 |
矩形面积交 (C语言代码)浏览:1307 |
C语言程序设计教程(第三版)课后习题12.2 (C语言代码)浏览:754 |
C语言程序设计教程(第三版)课后习题7.2 (C语言代码)浏览:740 |
1202题解浏览:622 |
1074(纳闷了,答案错误,求指教)浏览:362 |
多组数据新方法浏览:355 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:1289 |