結果

問題 No.251 大きな桁の復習問題(1)
ユーザー maine_honzukimaine_honzuki
提出日時 2021-05-04 16:51:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 548 bytes
コンパイル時間 9,003 ms
コンパイル使用メモリ 432,104 KB
実行使用メモリ 4,456 KB
最終ジャッジ日時 2023-09-30 18:28:37
合計ジャッジ時間 10,490 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,332 KB
testcase_01 WA -
testcase_02 AC 2 ms
4,328 KB
testcase_03 AC 1 ms
4,332 KB
testcase_04 AC 1 ms
4,328 KB
testcase_05 AC 1 ms
4,332 KB
testcase_06 AC 2 ms
4,332 KB
testcase_07 AC 1 ms
4,332 KB
testcase_08 AC 1 ms
4,356 KB
testcase_09 AC 36 ms
4,328 KB
testcase_10 AC 36 ms
4,328 KB
testcase_11 AC 36 ms
4,328 KB
testcase_12 AC 36 ms
4,332 KB
testcase_13 AC 37 ms
4,332 KB
testcase_14 AC 36 ms
4,328 KB
testcase_15 AC 36 ms
4,328 KB
testcase_16 AC 36 ms
4,332 KB
testcase_17 AC 36 ms
4,328 KB
testcase_18 AC 35 ms
4,332 KB
testcase_19 AC 36 ms
4,332 KB
testcase_20 AC 2 ms
4,328 KB
testcase_21 AC 1 ms
4,332 KB
testcase_22 AC 1 ms
4,332 KB
testcase_23 AC 1 ms
4,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//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;
    if (N == 0 && M == 0)
        ans = 0;
    while (M) {
        if (M % 2 == 1) {
            ans *= N;
            ans %= mod;
        }
        N *= N;
        N %= mod;
        M /= 2;
    }
    cout << ans << endl;
}
0