結果

問題 No.557 点対称
ユーザー ttttan
提出日時 2019-01-08 15:48:09
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 422 bytes
コンパイル時間 1,442 ms
コンパイル使用メモリ 157,740 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-24 00:42:43
合計ジャッジ時間 2,476 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod=1000000007;
int main(){
    ll n;cin>>n;
    if(n==1){
        cout<<2<<endl;
        return 0;
    }
    ll ans=4;
    ll x=n/2-1;
    ll now=5;
    while(x>0){
        if(x%2==1){
            ans*=now;
            ans%=mod;
        }
        now*=now;
        now%=mod;
      x/=2;
    }
    if(n%2==1)ans*=3;
    ans%=mod;
    cout<<ans<<endl;
}
0