結果

問題 No.2748 Strange Clock
ユーザー ponjuiceponjuice
提出日時 2024-04-19 14:09:05
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,540 bytes
コンパイル時間 2,007 ms
コンパイル使用メモリ 200,784 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-19 14:09:08
合計ジャッジ時間 2,962 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 1 ms
6,944 KB
testcase_11 AC 1 ms
6,944 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 1 ms
6,940 KB
testcase_14 AC 1 ms
6,940 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 AC 1 ms
6,944 KB
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 1 ms
6,944 KB
testcase_19 AC 1 ms
6,944 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 1 ms
6,940 KB
testcase_22 AC 1 ms
6,940 KB
testcase_23 AC 1 ms
6,940 KB
testcase_24 AC 1 ms
6,940 KB
testcase_25 AC 1 ms
6,944 KB
testcase_26 AC 1 ms
6,940 KB
testcase_27 AC 1 ms
6,944 KB
testcase_28 AC 1 ms
6,940 KB
testcase_29 AC 1 ms
6,940 KB
testcase_30 AC 1 ms
6,944 KB
testcase_31 AC 1 ms
6,940 KB
testcase_32 AC 1 ms
6,944 KB
testcase_33 AC 2 ms
6,940 KB
testcase_34 AC 2 ms
6,944 KB
testcase_35 AC 1 ms
6,940 KB
testcase_36 AC 2 ms
6,944 KB
testcase_37 AC 1 ms
6,944 KB
testcase_38 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;

const vector<vector<ll>> ch = {
    {},
    {1, 10},
    {1, 142},
    {1, 286, 1438, 1726},
    {1, 5470, 15262, 20734},
    {1, 15262, 26206, 41470, 192094, 207358, 233566, 248830}, // 5
    {1, 264094, 705022, 2016862, 2280958, 2721886, 2985982},
    {1, 3250078, 5971966, 9222046, 20637790, 26609758, 29859838, 35831806},
    {1, 80885662, 182409118, 194353054, 235628638, 247572574, 349096030, 429981694},
    {1, 859963390, 4299816958, 5159780350},
    {1, 16339304446, 45578059774, 61917364222}, // 10
    {1, 123834728446, 619173642238, 743008370686},
    {1, 2105190383614, 6810910064638, 8916100448254},
    {1, 17832200896510, 89161004482558, 106993205379070},
    {1, 1283918464548862},
    {1, 2567836929097726, 12839184645488638, 15407021574586366} // 15
};
const vector<vector<ll>> cnt = {
    {},
    {2, 1},
    {6, 3},
    {18, 3, 3, 3},
    {54, 6, 6, 15},
    {162, 18, 6, 15, 6, 15, 6, 15}, // 5
    {486, 18, 54, 12, 42, 6, 111},
    {1458, 18, 243, 18, 18, 18, 207, 207},
    {4374, 108, 18, 18, 18, 18, 108, 1899},
    {13122, 2187, 2187, 2187},
    {39366, 4374, 4374, 10935}, // 10
    {118098, 19683, 19683, 19683},
    {354294, 39366, 39366, 98415},
    {1062882, 177147, 177147, 177147},
    {3188646, 1594323},
    {9565938, 1594323, 1594323, 1594323}
};

int main(){
    ll n, m;
    cin >> n >> m;

    ll ans = 0;
    for (int i = 0; i < (int)ch[n].size(); i++) {
        if(ch[n][i] > m) ans += cnt[n][i]; 
    }

    cout << ans << endl;
}
0