結果

問題 No.16 累乗の加算
コンテスト
ユーザー kuramu
提出日時 2016-01-29 09:50:39
言語 Java
(openjdk 26.0.2.1 + ACL)
コンパイル:
javac -J-Duser.language=en -encoding UTF8 -cp /opt/aclib/ac_library.jar _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true -cp .:/opt/aclib/ac_library.jar _class_
結果
TLE  
実行時間 -
コード長 807 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,431 ms
コンパイル使用メモリ 82,912 KB
実行使用メモリ 234,548 KB
最終ジャッジ日時 2026-09-01 19:24:30
合計ジャッジ時間 8,555 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 TLE * 1 -- * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args) {
	      BufferedReader stdReader =new BufferedReader(new InputStreamReader(System.in));
	      try {
	    	  String[] temp1 = stdReader.readLine().split(" ");
	    	  int x = Integer.parseInt(temp1[0]);
	    	  int N = Integer.parseInt(temp1[1]);
	    	  String[] temp2 = stdReader.readLine().split(" ");
	    	  BigInteger ans = BigInteger.valueOf(0);
	    	  for(int i=0;i<N;i++){
	    		  ans = ans.add(BigInteger.valueOf(x).pow(Integer.parseInt(temp2[i])));
	    	  }	    	  
	    	  System.out.println(ans.remainder(BigInteger.valueOf(1000003)));
	      } catch (IOException e) {
			e.printStackTrace();
	      }
	}
}
0