結果

問題 No.16 累乗の加算
ユーザー core123core123
提出日時 2019-05-07 10:02:50
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 555 bytes
コンパイル時間 4,075 ms
コンパイル使用メモリ 72,328 KB
実行使用メモリ 58,116 KB
最終ジャッジ日時 2023-09-14 16:23:09
合計ジャッジ時間 6,061 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
54,224 KB
testcase_01 AC 128 ms
55,492 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 129 ms
55,896 KB
testcase_12 WA -
testcase_13 AC 139 ms
55,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.*;
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		int x=sc.nextInt();
		int n=sc.nextInt();
		int a[] = new int[n];
		for(int i=0;i<n;i++) {
			a[i]=sc.nextInt();
		}
		BigInteger ans=BigInteger.ZERO;
		BigInteger MOD=BigInteger.valueOf(1000003);
		BigInteger xx=BigInteger.valueOf(x);
		for(int i=0;i<n;i++) {
			ans=ans.add(xx.modPow(BigInteger.valueOf(a[i]), MOD));
		}
		System.out.println(ans);
	}

}
0