Eatings


私信TA

用户名:Eatings

访问量:1162

签 名:

Eatings

等  级
排  名 27228
经  验 509
参赛次数 0
文章发表 2
年  龄 20
在职情况 学生
学  校 哈尔滨华德学院
专  业 软件工程

  自我简介:

TA的其他文章

解题思路:

在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 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答

代码解释器

  评论区