結果
問題 | No.16 累乗の加算 |
ユーザー |
![]() |
提出日時 | 2015-08-08 18:50:29 |
言語 | Java21 (openjdk 21) |
結果 |
TLE
|
実行時間 | - |
コード長 | 800 bytes |
コンパイル時間 | 1,874 ms |
コンパイル使用メモリ | 72,092 KB |
実行使用メモリ | 54,732 KB |
最終ジャッジ日時 | 2023-09-25 07:10:39 |
合計ジャッジ時間 | 8,780 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 42 ms
49,912 KB |
testcase_01 | AC | 44 ms
49,636 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 | -- | - |
ソースコード
import java.io.*; import java.util.StringTokenizer; class Main{ static final PrintWriter out=new PrintWriter(System.out); static final int mod=1000003; public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line=""; while((line=br.readLine())!=null&&!line.isEmpty()){ StringTokenizer st1=new StringTokenizer(line); int n=Integer.parseInt(st1.nextToken()); line=br.readLine(); StringTokenizer st2=new StringTokenizer(line); int ans=0; while(st2.hasMoreTokens()){ int a=Integer.parseInt(st2.nextToken()); ans+=pow_mod_1000003(n,a); ans%=mod; } out.println(ans); out.flush(); } } private static int pow_mod_1000003(int n,int a){ int p=1; if(a==0) return 1; n%=mod; for(int i=0;i<a;i++){ p*=n; p%=mod; } return p; } }