結果
問題 | No.2007 Arbitrary Mod (Easy) |
ユーザー |
|
提出日時 | 2022-07-15 21:21:20 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 665 bytes |
コンパイル時間 | 655 ms |
コンパイル使用メモリ | 79,088 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-27 16:37:59 |
合計ジャッジ時間 | 3,361 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
#include<iostream>#include<string>#include<iomanip>#include<cmath>#include<vector>#include<algorithm>#include<utility>using namespace std;#define int long long#define endl "\n"constexpr long long INF = 1e18;constexpr long long MOD = 1000000007;struct fast_io {fast_io(){std::cin.tie(nullptr);std::ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);};} fio;long long power(long long x, long long n){long long ans = 1;for(;n;n >>= 1, x *= x, ans %= MOD, x %= MOD) if(n&1)ans*=x;return ans % MOD;}signed main(){int a, n;cin>>a>>n;cout<<MOD<<endl;cout<<power(a, n)<<endl;return 0;}