結果

問題 No.557 点対称
ユーザー Manuel1024
提出日時 2021-05-05 21:12:11
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 557 bytes
コンパイル時間 504 ms
コンパイル使用メモリ 64,796 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-13 14:05:19
合計ジャッジ時間 1,491 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
using ll = long long int;
const ll MOD = 1'000'000'007;

ll modpow(ll a, ll x){
    ll ans = 1;
    while(x > 0){
        if(x & 1){
            ans *= a;
            ans %= MOD;
        }
        a *= a;
        a %= MOD;
        x >>= 1;
    }
    return ans;
}

int main(){
    ll n;
    cin >> n;
    if(n == 1) cout << 2 << endl;
    else{
        ll ans = 4;
        ans *= modpow(5, n/2-1);
        ans %= MOD;
        if(n % 2) ans *= 3;
        ans %= MOD;
        cout << ans << endl;
    }
    return 0;
}
0