結果

問題 No.16 累乗の加算
ユーザー core123
提出日時 2019-05-07 10:02:50
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 555 bytes
コンパイル時間 2,156 ms
コンパイル使用メモリ 74,492 KB
実行使用メモリ 41,972 KB
最終ジャッジ日時 2024-07-01 23:30:52
合計ジャッジ時間 5,243 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4 WA * 10
権限があれば一括ダウンロードができます

ソースコード

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