結果
問題 | No.16 累乗の加算 |
ユーザー |
![]() |
提出日時 | 2019-02-24 15:21:12 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 175 ms / 5,000 ms |
コード長 | 683 bytes |
コンパイル時間 | 5,319 ms |
コンパイル使用メモリ | 75,972 KB |
実行使用メモリ | 42,260 KB |
最終ジャッジ日時 | 2024-12-23 01:03:55 |
合計ジャッジ時間 | 7,631 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 |
ソースコード
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));}}