結果
| 問題 | 
                            No.2007 Arbitrary Mod (Easy)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             sorag
                         | 
                    
| 提出日時 | 2022-07-16 16:13:52 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 446 bytes | 
| コンパイル時間 | 650 ms | 
| コンパイル使用メモリ | 63,616 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-28 15:46:01 | 
| 合計ジャッジ時間 | 4,019 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 3 | 
| other | WA * 30 | 
ソースコード
#include <iostream>
using namespace std;
const int MOD = 10000000;
long long pow(long long x, long long n) {
    long long ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * x % MOD;  // n の最下位bitが 1 ならば x^(2^i) をかける
        x = x * x % MOD;
        n >>= 1;  // n を1bit 左にずらす
    }
    return ret;
}
int main() {
    long long a, b;
    cin >> a >> b;
    cout << pow(a, b) << endl;
    return 0;
}
            
            
            
        
            
sorag