結果

問題 No.16 累乗の加算
ユーザー ぴろずぴろず
提出日時 2014-12-19 14:46:42
言語 Java21
(openjdk 21)
結果
AC  
実行時間 152 ms / 5,000 ms
コード長 455 bytes
コンパイル時間 2,361 ms
コンパイル使用メモリ 71,876 KB
実行使用メモリ 56,164 KB
最終ジャッジ日時 2023-09-08 11:31:23
合計ジャッジ時間 5,394 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
56,080 KB
testcase_01 AC 125 ms
56,056 KB
testcase_02 AC 152 ms
56,164 KB
testcase_03 AC 139 ms
56,052 KB
testcase_04 AC 140 ms
54,192 KB
testcase_05 AC 141 ms
55,960 KB
testcase_06 AC 149 ms
56,024 KB
testcase_07 AC 147 ms
55,812 KB
testcase_08 AC 150 ms
55,756 KB
testcase_09 AC 151 ms
56,032 KB
testcase_10 AC 148 ms
56,156 KB
testcase_11 AC 126 ms
55,784 KB
testcase_12 AC 148 ms
55,784 KB
testcase_13 AC 130 ms
55,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no016;

import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		BigInteger x = new BigInteger(sc.next());
		BigInteger MOD = new BigInteger("1000003");
		int n = sc.nextInt();
		BigInteger ans = BigInteger.ZERO;
		for(int i=0;i<n;i++) {
			ans = ans.add(x.modPow(new BigInteger(sc.next()), MOD));
		}
		System.out.println(ans.mod(MOD));
	}

}
0