解题思路:
在Java语言,当计算大数时,会引用BigInteger这个类。从而进行,加、减、乘、除、取余等运算~
注意事项:
参考代码:
import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); BigInteger sum = new BigInteger("1"); for(int i = 0; i < n; i++) { int a = sc.nextInt(); sum = sum.multiply(new BigInteger(String.valueOf(a))); } System.out.println(sum.remainder(new BigInteger(String.valueOf(10)))); } }
0.0分
5 人评分
C二级辅导-求偶数和 (C语言代码)浏览:603 |
C语言程序设计教程(第三版)课后习题11.3 (C语言代码)浏览:1052 |
大小写转换 (C语言代码)浏览:839 |
Pascal三角 (C语言代码)格式错误浏览:516 |
C语言训练-求函数值 (C语言代码)浏览:571 |
简单的a+b (C语言代码)浏览:335 |
C语言程序设计教程(第三版)课后习题7.3 (C语言代码)浏览:1195 |
C语言程序设计教程(第三版)课后习题8.1 (C语言代码)浏览:1242 |
WU-小九九 (C++代码)浏览:1681 |
2005年春浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:582 |