結果
問題 |
No.16 累乗の加算
|
ユーザー |
|
提出日時 | 2014-11-19 16:37:08 |
言語 | Java (openjdk 23) |
結果 |
TLE
|
実行時間 | - |
コード長 | 469 bytes |
コンパイル時間 | 3,152 ms |
コンパイル使用メモリ | 76,248 KB |
実行使用メモリ | 83,328 KB |
最終ジャッジ日時 | 2025-01-02 19:20:44 |
合計ジャッジ時間 | 64,009 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 WA * 2 TLE * 9 |
ソースコード
import java.util.Scanner; public class Yukicoder16 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int N = sc.nextInt(); long res = 0; for (int i = 0; i < N; i++) { res += powMod(x, sc.nextInt()) % 1000003; } System.out.println(res); } static long powMod(int a, int n) { long res = 1; for (int i = 0; i < n; i++) { res = a * (res % 1000003); } return res; } }