結果

問題 No.976 2 の 128 乗と M
ユーザー firiexp
提出日時 2020-01-31 21:25:11
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 707 bytes
コンパイル時間 890 ms
コンパイル使用メモリ 93,180 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-02 03:32:23
合計ジャッジ時間 2,565 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>
#include <limits>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template <class T>
T pow_ (T x, T n, T M){
    __uint128_t u = 1, xx = x;
    while (n > 0){
        if (n&1) u = u * xx % M;
        xx = xx * xx % M;
        n >>= 1;
    }
    return static_cast<T>(u);
};

int main() {
    ll m;
    cin >> m;
    cout << pow_(2LL, 128LL, m) << "\n";
    return 0;
}
0