結果
問題 | No.403 2^2^2 |
ユーザー |
![]() |
提出日時 | 2016-07-22 23:37:32 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,091 bytes |
コンパイル時間 | 1,593 ms |
コンパイル使用メモリ | 166,080 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-06 09:29:21 |
合計ジャッジ時間 | 2,532 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 WA * 4 |
ソースコード
#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; }