結果

問題 No.16 累乗の加算
ユーザー kohaku_kohaku
提出日時 2016-11-14 20:41:46
言語 Java
(openjdk 23)
結果
TLE  
実行時間 -
コード長 481 bytes
コンパイル時間 2,163 ms
コンパイル使用メモリ 74,652 KB
実行使用メモリ 80,540 KB
最終ジャッジ日時 2024-11-26 01:19:47
合計ジャッジ時間 68,796 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3 WA * 1 TLE * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int N = sc.nextInt();
        int m = 1000003;
        int sum=0;
        for(int i=0; i<N; i++){
            int t=1;
            int a = sc.nextInt();
            while(a!=0){
                t=t*x%m;
                a--;
            }
            sum=sum+t;
        }
        System.out.println(sum);
    }
}
0