結果
問題 | No.403 2^2^2 |
ユーザー |
![]() |
提出日時 | 2018-06-06 15:36:30 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 660 bytes |
コンパイル時間 | 1,367 ms |
コンパイル使用メモリ | 158,876 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-30 10:15:27 |
合計ジャッジ時間 | 2,137 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:22:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 22 | scanf("%lld^%lld^%lld",&a,&b,&c);a%=MOD; | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<bits/stdc++.h>using namespace std;#define all(vec) vec.begin(),vec.end()typedef long long int ll;typedef pair<ll,ll> P;const ll MOD=1000000007;const ll INF=1000000010;const ll LINF=4000000000000000010LL;const int MAX=310;const double EPS=1e-3;int dx[4]={0,1,0,1};int dy[4]={0,0,1,1};ll mod_pow(ll x,ll p,ll mod){if(x==0)return 0;if(p==0)return 1;ll res=mod_pow((x*x)%mod,p/2,mod);if(p%2)(res*=x)%=mod;return res;}int main(){ll a,b,c;scanf("%lld^%lld^%lld",&a,&b,&c);a%=MOD;ll ansa=mod_pow(mod_pow(a,b,MOD),c,MOD);b%=MOD-1;ll ansb=mod_pow(a,mod_pow(b,c,MOD-1)+MOD-1,MOD);cout<<ansa<<" "<<ansb<<endl;return 0;}