結果
| 問題 | No.793 うし数列 2 | 
| コンテスト | |
| ユーザー |  dsytk7 | 
| 提出日時 | 2019-02-23 00:15:28 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 778 bytes | 
| コンパイル時間 | 1,332 ms | 
| コンパイル使用メモリ | 166,420 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-26 07:12:10 | 
| 合計ジャッジ時間 | 2,050 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 21 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=(0);(i)<(int)(n);++(i))
using ll = long long;
using P = pair<ll, ll>;
using namespace std;
template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}
ll mod_pow(ll x, ll n, ll mod=1e9+7)
{
    ll ret = 1;
    while (n > 0)
    {
        if (n&1) ret = ret * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return ret;
}
// / a (MOD mod)
ll mod_inv(ll a, ll mod=1e9+7)
{
    return mod_pow(a, mod-2, mod);
}
int main()
{
    const ll mod = 1e9 + 7;
    ll n;
    cin >> n;
    ll ans = mod_pow(10, n);
    ans = ans * 4 % mod;
    ans = (ans - 1) % mod;
    ans = ans * mod_inv(3) % mod;
    cout << ans << endl;
}
            
            
            
        