結果

問題 No.793 うし数列 2
ユーザー rtia_iidxrtia_iidx
提出日時 2019-02-22 22:43:22
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,416 bytes
コンパイル時間 704 ms
コンパイル使用メモリ 97,500 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-08-16 20:33:27
合計ジャッジ時間 1,728 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 3 ms
4,380 KB
testcase_02 AC 3 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:79:25: 警告: ‘tmp’ may be used uninitialized [-Wmaybe-uninitialized]
   79 |     cout << (ans + (tmp)*2)%MOD << endl;
      |                    ~~~~~^~
main.cpp:73:8: 備考: ‘tmp’ はここで定義されています
   73 |     ll tmp;
      |        ^~~

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>

using namespace std;

#define ll long long int

ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n;
    cin >> n;

    ll x = n%(MOD-1);

    ll y = (((MOD)*(MOD-1))/2)%MOD;

    ll z = ((((n/(MOD-1))%MOD)*y)%MOD);

    ll base = 1;
    ll t = 1;

    for(int i = 1; i < 100000; i++){
        base = (base*10 + 1)%MOD;
        t++;
    }

    ll base2 = base;

    for(int i = 1; i < 100000; i++){
        base2 = (base2 * 100000 + base)%MOD;
    }

    ll base3 = base2;
    for(int i = 1; i < 10000; i++){
        base3 = (base3 * 10000 + base2)%MOD;
    }

    ll ans = 1;

    while(n > 100000000000000){
        n -= 100000000000000;
        ans = (ans * 100000000000000 + base3)%MOD;
    }

    while(n > 10000000000){
        n-= 10000000000;
        ans = (ans * 10000000000 + base2)%MOD;
    }

    while(n > 100000){
        n -= 100000;
        ans = (ans * 100000 + base)%MOD;
    }

    ll tmp;
    for(int i = 0; i < n; i++){
        tmp = ans;
        ans = (ans*10 + 1)%MOD;
    }

    cout << (ans + (tmp)*2)%MOD << endl;
    
    return 0;
}
0