結果
| 問題 | 
                            No.16 累乗の加算
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2016-04-13 02:46:54 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 520 bytes | 
| コンパイル時間 | 2,332 ms | 
| コンパイル使用メモリ | 74,052 KB | 
| 実行使用メモリ | 60,848 KB | 
| 最終ジャッジ日時 | 2024-10-04 06:48:25 | 
| 合計ジャッジ時間 | 8,963 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 2 TLE * 1 -- * 11 | 
ソースコード
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		final int m = 1000003;
		int x = scanner.nextInt();
		int N = scanner.nextInt();
		int[] a = new int[N];
		for (int i = 0; i < N; i++) {
			a[i] = scanner.nextInt();
		}
		int sum = 0;
		for (int i = 0; i < N; i++) {
			int xa = 1;
			for (int j = 0; j < a[i]; j++) {
				xa *= x;
				while (xa > m) {
					xa -= m;
				}
			}
			sum += xa;
		}
		System.out.println(sum % m);
	}
}