結果

問題 No.16 累乗の加算
ユーザー aaaaasatoriaaaaasatori
提出日時 2018-02-18 15:37:20
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 553 bytes
コンパイル時間 4,013 ms
コンパイル使用メモリ 72,864 KB
実行使用メモリ 77,240 KB
最終ジャッジ日時 2023-09-06 18:22:50
合計ジャッジ時間 10,980 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class No16 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long x = sc.nextLong();
		int N = sc.nextInt();
		List<Long> a = new ArrayList<Long>();
		for(int i = 0;i < N;i++) {
			a.add(sc.nextLong());
		}
		long xn = 1;
		long sum = 0;
		for(long i = 0;i <= a.get(a.size()-1);i++) {
			if(i != 0) {
				xn = xn * x % 1000003;
			}
			if(a.indexOf(i) != -1) {
				sum = (sum + xn) % 1000003;
			}
		}
		System.out.println(sum);
	}
}
0