結果
| 問題 |
No.16 累乗の加算
|
| コンテスト | |
| ユーザー |
kpinkcat
|
| 提出日時 | 2023-10-09 02:00:25 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 597 bytes |
| コンパイル時間 | 779 ms |
| コンパイル使用メモリ | 104,208 KB |
| 最終ジャッジ日時 | 2025-02-17 06:21:57 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 WA * 11 |
ソースコード
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<list>
#include<queue>
#include<math.h>
#include<bitset>
using ll = long long;
using namespace std;
int main(){
ll x, n, ans = 0, mod = 1000003;
cin >> x >> n;
for (int i = 0; i < n; i++){
ll a, x1, tmp= 1;
cin >> a;
x1 = 1;
tmp = x;
while (a){
if (a & 1) x1 *= tmp;
tmp *= tmp;
tmp %= mod;
a >>= 1;
}
ans += x1;
ans %= mod;
}
cout << ans << endl;
}
kpinkcat