結果

問題 No.251 大きな桁の復習問題(1)
ユーザー mamekinmamekin
提出日時 2016-04-07 21:27:25
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,040 bytes
コンパイル時間 1,129 ms
コンパイル使用メモリ 102,364 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-14 22:25:32
合計ジャッジ時間 2,425 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

const int MOD = 129402307;

long long power(long long a, long long b)
{
    long long ret = 1;
    long long tmp = a;
    while(b > 0){
        if(b & 1){
            ret *= tmp;
            ret %= MOD;
        }
        tmp *= tmp;
        tmp %= MOD;
        b >>= 1;
    }
    return ret;
}

int main()
{
    string s, t;
    cin >> s >> t;

    long long n = 0;
    for(char c : s){
        n *= 10;
        n += c - '0';
        n %= MOD;
    }

    long long m = 0;
    for(char c : t){
        m *= 10;
        m += c - '0';
        m %= MOD - 1;
    }

    cout << power(n, m) << endl;

    return 0;
}
0