結果
問題 |
No.557 点対称
|
ユーザー |
![]() |
提出日時 | 2017-08-11 22:35:08 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 665 bytes |
コンパイル時間 | 1,476 ms |
コンパイル使用メモリ | 166,624 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 21:17:42 |
合計ジャッジ時間 | 2,380 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define FOR(i,l,r) for(int i = int(l);i < int(r);i++) template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; } template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; } typedef long long ll; ll N; const ll MOD = 1e9 + 7; ll mod_pow(ll x,ll y = MOD - 2) { ll res = 1; while(y){ if(y & 1) (res *= x) %= MOD; (x *= x) %= MOD; y >>= 1; } return res; } int main() { scanf("%lld",&N); if(N == 1){ puts("2"); return 0; } ll ans = 1; if(N % 2){ ans *= 3; } (ans *= mod_pow(5,N / 2 - 1) * 4) %= MOD; printf("%lld\n",ans); return 0; }