library

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

View the Project on GitHub beet-aizu/library

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

Depends on

Code

// verification-helper: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_B

#include <bits/stdc++.h>
using namespace std;

#define call_from_test
#include "../../mod/pow.cpp"
#undef call_from_test

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

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

  const int MOD = 1e9+7;
  cout<<mod_pow(n,m,MOD)<<endl;
  return 0;
}
#line 1 "test/aoj/NTL_1_B.test.cpp"
// verification-helper: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_B

#include <bits/stdc++.h>
using namespace std;

#define call_from_test
#line 1 "mod/pow.cpp"

#line 3 "mod/pow.cpp"
using namespace std;
#endif
//BEGIN CUT HERE
// MOD can be composite numbers
template<typename T>
T mod_pow(T a,long long n,const T MOD){
  using ll = long long;
  T res(1);
  while(n){
    if(n&1) res=(ll)res*a%MOD;
    a=(ll)a*a%MOD;
    n>>=1;
  }
  return res;
}
//END CUT HERE
#ifndef call_from_test
//INSERT ABOVE HERE
signed main(){
  return 0;
}
#endif
#line 8 "test/aoj/NTL_1_B.test.cpp"
#undef call_from_test

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

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

  const int MOD = 1e9+7;
  cout<<mod_pow(n,m,MOD)<<endl;
  return 0;
}
Back to top page