結果

問題 No.403 2^2^2
ユーザー nasadigitalnasadigital
提出日時 2016-07-22 23:33:54
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,091 bytes
コンパイル時間 1,251 ms
コンパイル使用メモリ 165,980 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 02:42:26
合計ジャッジ時間 1,994 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define MOD 1000000007

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;

vector<string> split(string a,char e){
    vector<string> rez;
    string cur;
    for(int ctr1=0;ctr1<a.size();ctr1++){
        if(a[ctr1]!=e)
            cur.push_back(a[ctr1]);
        else
            rez.push_back(cur),cur.clear();
    }
    if(cur!="")
        rez.push_back(cur);
    return rez;
}

ll stroi(string a){
    ll rez=0;
    for(int ctr1=0;ctr1<a.size();ctr1++)
        rez*=10,rez+=a[ctr1]-'0';
    return rez;
}

ll ipow(ll base, ll exp, ll mod)
{
    ll result = 1;
    while (exp)
    {
        if (exp & 1)
            result = (result*base)%mod;
        exp >>= 1;
        base = (base*base)%mod;
    }
    return result;
}

int main()
{
    string s;
    cin>>s;
    vector<string> r=split(s,'^');
    vector<ll> no;
    for(int ctr1=0;ctr1<3;ctr1++)
        no.push_back(stroi(r[ctr1]));
    cout<< ipow(ipow(no[0]%MOD,no[1]%(MOD-1),MOD),no[2]%(MOD-1),MOD) << " " << ipow(no[0]%MOD, ipow(no[1]%(MOD-1),no[2],MOD-1),MOD) <<"\n";
    return 0;
}
0