結果

問題 No.793 うし数列 2
ユーザー ttttan
提出日時 2019-03-03 22:17:27
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 430 bytes
コンパイル時間 1,395 ms
コンパイル使用メモリ 157,644 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-23 13:18:34
合計ジャッジ時間 1,922 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod=1000000007;
ll beki(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k%2==1){
            ret*=now;
            ret%=mod;
        }
        now=now*now;
        now%=mod;
        k/=2;
    }
    return ret;
    
}
int main(){
    ll n;cin>>n;
    ll u=beki(10,n);
    ll t=beki(3,mod-2);
    t=(t*(u-1))%mod;
    cout<<(u+t)%mod<<endl;
}
0