結果
| 問題 | 
                            No.16 累乗の加算
                             | 
                    
| コンテスト | |
| ユーザー | 
                             kpinkcat
                         | 
                    
| 提出日時 | 2023-10-09 01:45:12 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 530 bytes | 
| コンパイル時間 | 863 ms | 
| コンパイル使用メモリ | 103,728 KB | 
| 最終ジャッジ日時 | 2025-02-17 06:21:54 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 2 TLE * 1 -- * 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++){
        int a, x1;
        cin >> a;
        x1 = 1;
        while (a){
            x1 *= x;
            x1 %= mod;
            a--;
        }
        ans += x1;
        ans %= mod;
    }
    cout << ans << endl;
}
            
            
            
        
            
kpinkcat