結果
| 問題 |
No.16 累乗の加算
|
| コンテスト | |
| ユーザー |
NaruY
|
| 提出日時 | 2016-12-09 20:40:29 |
| 言語 | Java (openjdk 23) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 794 bytes |
| コンパイル時間 | 2,282 ms |
| コンパイル使用メモリ | 76,732 KB |
| 実行使用メモリ | 62,532 KB |
| 最終ジャッジ日時 | 2024-11-28 19:48:35 |
| 合計ジャッジ時間 | 4,810 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | RE * 14 |
ソースコード
import java.io.*;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main (String[] args) throws IOException
{
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int N = sc.nextInt();
int a[] = new int [N+1];
long s[] = new long [100000002];
long ans = 0;
for (int i = 1 ; i <= N ; i++){
a[i] = sc.nextInt();
}
s[0] = 1;
s[1] = x;
for (int i=2 ;i <= 100000000 ;i++){
s[i] = (s[i-1] * x) % 1000003;
}
for (int j=1 ; j <= N ; j++){
ans = ans + s[a[j]];
}
System.out.println(ans);
}
}
NaruY