結果
| 問題 | No.793 うし数列 2 | 
| コンテスト | |
| ユーザー |  ngtkana | 
| 提出日時 | 2020-03-13 21:38:03 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 9 ms / 2,000 ms | 
| コード長 | 427 bytes | 
| コンパイル時間 | 2,750 ms | 
| コンパイル使用メモリ | 190,888 KB | 
| 最終ジャッジ日時 | 2025-01-09 06:39:08 | 
| ジャッジサーバーID (参考情報) | judge1 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 21 | 
ソースコード
#include<bits/stdc++.h>
#define endl enjoy_codeforces
using lint=long long;
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    lint mod=1'000'000'007;
    lint inv3=(1+mod)/3;
    lint n;std::cin>>n;
    lint ans=1;
    for(lint pow10=10;n;n>>=1){
        if(n&1)ans=ans*pow10%mod;
        pow10=pow10*pow10%mod;
    }
    std::cout<<(4*ans-1)*inv3%mod<<'\n';
}
/*
 * 133333...*3=(4*10^n-1)/3
 */
            
            
            
        