結果
問題 | No.557 点対称 |
ユーザー |
|
提出日時 | 2017-08-18 05:07:11 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 934 bytes |
コンパイル時間 | 1,643 ms |
コンパイル使用メモリ | 167,276 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-14 14:28:45 |
合計ジャッジ時間 | 2,631 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define all(x) (x).begin(),(x).end() #define pb push_back #define fi first #define se second #define dbg(x) cout<<#x" = "<<((x))<<endl template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;} template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;} const ll mod = 1e9+7; ll mod_pow(ll x, ll n) { ll ret = 1; while(n) { if(n&1) (ret*=x)%=mod; (x*=x)%=mod; n>>=1; } return ret; } ll solve(ll n) { if(n==1) return 2; ll ret = 1; if(n%2==1) { --n; ret = 3; } n-=2; ret*=4; (ret*=mod_pow(5,n/2))%=mod; return ret; } int main() { ll n; cin >>n; cout << solve(n) << endl; return 0; }