返回题解分享
讨论 / 题解分享/ 帖子详情

八次求和(编程题) - 题解

import java.math.BigInteger;

import java.util.Scanner;

public class Main {

public static void main(String[] args) {

	Scanner cin = new Scanner(System.in);

	int n = cin.nextInt();

	BigInteger bi = new BigInteger("0");

	for (int i = 0; i <= n; i++) {

		BigInteger temp = new BigInteger(i+"");

		temp = temp.pow(8);

		bi = bi.add(temp);

		bi = bi.mod(new BigInteger("123456789"));

	}

	System.out.println(bi.toString());

	

}


}
0 回复 0 转发 0 喜欢 0 阅读
回复 (0)
默认 最新
暂无回复,快来抢沙发!