結果

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

ソースコード

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 ans=u+(u-1)/3;
    cout<<ans%mod<<endl;
}
0