結果

問題 No.793 うし数列 2
ユーザー face4
提出日時 2019-02-23 09:26:33
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 417 bytes
コンパイル時間 655 ms
コンパイル使用メモリ 63,708 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-28 15:35:00
合計ジャッジ時間 1,291 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;
typedef long long ll;

const ll mod = 1e9 + 7;

ll modpow(ll a, ll b, ll p = 1e9+7){
    if(b == 0)  return 1;

    if(b % 2 == 0){
        ll d = modpow(a, b/2, p);
        return (d*d) % p;
    }else{
        return (a%p * modpow(a, b-1, p)) % p;
    }
}

int main(){
    ll n;
    cin >> n;
    cout << ((4*modpow(10,n)-1)%mod * modpow(3,mod-2))%mod << endl;
    return 0;
}
0