結果

問題 No.16 累乗の加算
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-14 20:41:46
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 481 bytes
コンパイル時間 1,933 ms
コンパイル使用メモリ 71,400 KB
実行使用メモリ 60,684 KB
最終ジャッジ日時 2023-08-17 06:46:02
合計ジャッジ時間 8,911 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
56,496 KB
testcase_01 AC 123 ms
55,544 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.*;

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