結果
| 問題 |
No.16 累乗の加算
|
| コンテスト | |
| ユーザー |
158b
|
| 提出日時 | 2015-05-27 22:20:00 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 540 ms / 5,000 ms |
| コード長 | 517 bytes |
| コンパイル時間 | 679 ms |
| コンパイル使用メモリ | 65,968 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-26 04:55:51 |
| 合計ジャッジ時間 | 6,799 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 |
ソースコード
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <limits.h>
#include <vector>
#include <numeric>
using namespace std;
int main(){
long x;
int n;
long sisuu[100];
long ans = 0;
long cnt = 0;
long now = 1;
cin >> x >> n;
for(int i=0; i<n; i++){
cin >> sisuu[i];
}
sort(sisuu, sisuu + n);
for(int i=0; i<n; i++){
while(sisuu[i] != cnt){
cnt ++;
now = (now * x) % 1000003;
}
ans = (ans + now) % 1000003;
}
cout << ans << endl;
return 0;
}
158b