結果
| 問題 |
No.16 累乗の加算
|
| コンテスト | |
| ユーザー |
holeguma
|
| 提出日時 | 2015-08-08 19:07:53 |
| 言語 | Java (openjdk 23) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 865 bytes |
| コンパイル時間 | 1,755 ms |
| コンパイル使用メモリ | 75,236 KB |
| 実行使用メモリ | 134,028 KB |
| 最終ジャッジ日時 | 2024-07-18 05:58:55 |
| 合計ジャッジ時間 | 8,278 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 TLE * 1 -- * 11 |
ソースコード
import java.io.*;
import java.util.StringTokenizer;
import java.math.BigInteger;
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){
BigInteger x=BigInteger.valueOf(n);
BigInteger y=BigInteger.valueOf(mod);
x=x.pow(a).remainder(y);
return x.intValue();
}
}
holeguma