結果

問題 No.16 累乗の加算
ユーザー fal_rndfal_rnd
提出日時 2016-10-29 20:21:42
言語 Java21
(openjdk 21)
結果
AC  
実行時間 157 ms / 5,000 ms
コード長 450 bytes
コンパイル時間 2,003 ms
コンパイル使用メモリ 72,376 KB
実行使用メモリ 56,100 KB
最終ジャッジ日時 2023-09-08 12:02:35
合計ジャッジ時間 4,957 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
56,040 KB
testcase_01 AC 126 ms
55,868 KB
testcase_02 AC 152 ms
55,948 KB
testcase_03 AC 139 ms
55,852 KB
testcase_04 AC 142 ms
55,960 KB
testcase_05 AC 143 ms
55,956 KB
testcase_06 AC 150 ms
55,804 KB
testcase_07 AC 149 ms
56,036 KB
testcase_08 AC 156 ms
56,100 KB
testcase_09 AC 157 ms
55,612 KB
testcase_10 AC 152 ms
55,800 KB
testcase_11 AC 128 ms
55,656 KB
testcase_12 AC 153 ms
55,940 KB
testcase_13 AC 138 ms
55,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.*;
import java.util.*;
class A{
	static Scanner s = new Scanner(System.in);
	static final int mod = 1_000_003;
	static final BigInteger modb = BigInteger.valueOf(mod);

	public static void main(String[] args) {
		BigInteger in = BigInteger.valueOf(s.nextInt());
		s.next();
		long r = 0;
		while(s.hasNext()) {
			r += Long.parseLong(in.modPow(BigInteger.valueOf(s.nextInt()), modb).toString());
		}
		System.out.println(r%mod);
	}
}
0