library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub rajyan/library

:heavy_check_mark: test/aoj/NTL_1_B.test.cpp

Depends on

Code

#define PROBLEM "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_B"

#include <iostream>
#include <iomanip>

using namespace std;

#include "../../src/modpow.hpp"

struct init {
    init() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
    }
} init_;

int main() {

    int m, n;
    cin >> m >> n;

    cout << modpow(m, n) << '\n';

    return 0;
}
#line 1 "test/aoj/NTL_1_B.test.cpp"

#define PROBLEM "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_B"

#include <iostream>
#include <iomanip>

using namespace std;

#line 2 "src/modpow.hpp"

using lint = long long;

lint modpow(lint a, lint n, lint mod = 1000000007) {
    lint res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
#line 10 "test/aoj/NTL_1_B.test.cpp"

struct init {
    init() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
    }
} init_;

int main() {

    int m, n;
    cin >> m >> n;

    cout << modpow(m, n) << '\n';

    return 0;
}
Back to top page