結果
問題 | No.16 累乗の加算 |
ユーザー | neko_the_shadow |
提出日時 | 2019-02-24 15:21:12 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 148 ms / 5,000 ms |
コード長 | 683 bytes |
コンパイル時間 | 3,130 ms |
コンパイル使用メモリ | 73,608 KB |
実行使用メモリ | 56,604 KB |
最終ジャッジ日時 | 2023-08-24 16:52:46 |
合計ジャッジ時間 | 6,154 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 122 ms
56,216 KB |
testcase_01 | AC | 118 ms
55,968 KB |
testcase_02 | AC | 148 ms
56,248 KB |
testcase_03 | AC | 132 ms
56,320 KB |
testcase_04 | AC | 135 ms
56,376 KB |
testcase_05 | AC | 136 ms
55,952 KB |
testcase_06 | AC | 143 ms
55,572 KB |
testcase_07 | AC | 144 ms
55,612 KB |
testcase_08 | AC | 146 ms
56,352 KB |
testcase_09 | AC | 148 ms
55,832 KB |
testcase_10 | AC | 147 ms
55,976 KB |
testcase_11 | AC | 122 ms
56,336 KB |
testcase_12 | AC | 143 ms
56,604 KB |
testcase_13 | AC | 128 ms
55,712 KB |
ソースコード
import java.math.BigInteger; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Scanner; import java.util.Set; public class Mian { public static void main(String[] args) { Scanner stdin = new Scanner(System.in); BigInteger x = stdin.nextBigInteger(); int n = stdin.nextInt(); BigInteger answer = BigInteger.ZERO; BigInteger divisor = new BigInteger("1000003"); for (int i = 0; i < n; i++) { BigInteger a = stdin.nextBigInteger(); answer = answer.add(x.modPow(a, divisor)); } System.out.println(answer.mod(divisor)); } }