結果
問題 |
No.16 累乗の加算
|
ユーザー |
![]() |
提出日時 | 2016-12-09 20:53:19 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 817 bytes |
コンパイル時間 | 3,776 ms |
コンパイル使用メモリ | 76,128 KB |
実行使用メモリ | 61,048 KB |
最終ジャッジ日時 | 2024-11-28 19:54:06 |
合計ジャッジ時間 | 4,884 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | RE * 14 |
ソースコード
import java.io.*; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Scanner; public class Main { public static void main (String[] args) throws IOException { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int N = sc.nextInt(); int a[] = new int [N+10]; long s[] = new long [100000002]; long ans = 0; a[0] = 0; for (int i = 1 ; i <= N ; i++){ a[i] = sc.nextInt(); } s[0] = 1; s[1] = x; for (int i=2 ;i <= 100000000 ;i++){ s[i] = (s[i-1] * x) % 1000003; } for (int j=1 ; j <= N ; j++){ ans = (ans + s[a[j]]) % 1000003 ; } System.out.println(ans); } }