結果
| 問題 | No.251 大きな桁の復習問題(1) | 
| コンテスト | |
| ユーザー |  maine_honzuki | 
| 提出日時 | 2021-05-04 16:50:13 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 505 bytes | 
| コンパイル時間 | 4,820 ms | 
| コンパイル使用メモリ | 399,616 KB | 
| 最終ジャッジ日時 | 2025-01-21 06:42:18 | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 19 WA * 2 | 
ソースコード
//https://ncode.syosetu.com/n4830bu/251/
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;
using namespace std;
using ll = long long;
const ll mod = 129402307;
int main() {
    cpp_int N, M;
    cin >> N >> M;
    N %= mod;
    M %= (mod - 1);
    cpp_int ans = 1;
    while (M) {
        if (M % 2 == 1) {
            ans *= N;
            ans %= mod;
        }
        N *= N;
        N %= mod;
        M /= 2;
    }
    cout << ans << endl;
}
            
            
            
        