結果
| 問題 | No.16 累乗の加算 |
| コンテスト | |
| ユーザー |
kyuridenamida
|
| 提出日時 | 2016-02-10 21:29:11 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 450 bytes |
| コンパイル時間 | 1,369 ms |
| コンパイル使用メモリ | 158,780 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-26 05:08:10 |
| 合計ジャッジ時間 | 2,088 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
long long bn[32];
int main(){
long long x;
cin >> x;
bn[0] = x;
for(int i = 1 ; i <= 31 ; i++)
bn[i] = (bn[i-1] * bn[i-1]) % 1000003;
int N;
cin >> N;
long long res = 0;
for(int i = 0 ; i < N ; i++){
int a;
cin >> a;
long long tot = 1;
for(int j = 0 ; j < 32 ; j++)
if( a >> j & 1 ) {
tot = tot * bn[j] % 1000003;
}
res += tot;
res %= 1000003;
}
cout << res << endl;
}
kyuridenamida