結果
問題 | No.16 累乗の加算 |
ユーザー | 158b |
提出日時 | 2015-05-27 22:20:00 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 544 ms / 5,000 ms |
コード長 | 517 bytes |
コンパイル時間 | 679 ms |
コンパイル使用メモリ | 67,144 KB |
実行使用メモリ | 4,384 KB |
最終ジャッジ日時 | 2023-09-08 11:39:56 |
合計ジャッジ時間 | 6,762 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,384 KB |
testcase_01 | AC | 2 ms
4,380 KB |
testcase_02 | AC | 542 ms
4,384 KB |
testcase_03 | AC | 209 ms
4,384 KB |
testcase_04 | AC | 265 ms
4,380 KB |
testcase_05 | AC | 308 ms
4,384 KB |
testcase_06 | AC | 378 ms
4,380 KB |
testcase_07 | AC | 415 ms
4,380 KB |
testcase_08 | AC | 486 ms
4,384 KB |
testcase_09 | AC | 530 ms
4,380 KB |
testcase_10 | AC | 521 ms
4,380 KB |
testcase_11 | AC | 544 ms
4,380 KB |
testcase_12 | AC | 542 ms
4,384 KB |
testcase_13 | AC | 540 ms
4,384 KB |
ソースコード
#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; }