結果

問題 No.1580 I like Logarithm!
ユーザー 👑 kakel-sankakel-san
提出日時 2021-07-02 23:50:58
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 267 ms / 2,000 ms
コード長 1,018 bytes
コンパイル時間 2,032 ms
コンパイル使用メモリ 69,760 KB
実行使用メモリ 32,008 KB
最終ジャッジ日時 2023-09-12 00:14:40
合計ジャッジ時間 8,695 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
21,724 KB
testcase_01 AC 57 ms
21,764 KB
testcase_02 AC 56 ms
21,748 KB
testcase_03 AC 57 ms
21,644 KB
testcase_04 AC 57 ms
21,700 KB
testcase_05 AC 59 ms
21,648 KB
testcase_06 AC 84 ms
25,188 KB
testcase_07 AC 81 ms
26,288 KB
testcase_08 AC 57 ms
21,636 KB
testcase_09 AC 72 ms
19,752 KB
testcase_10 AC 75 ms
20,072 KB
testcase_11 AC 82 ms
23,772 KB
testcase_12 AC 84 ms
23,876 KB
testcase_13 AC 72 ms
20,820 KB
testcase_14 AC 132 ms
24,428 KB
testcase_15 AC 135 ms
25,940 KB
testcase_16 AC 59 ms
21,828 KB
testcase_17 AC 57 ms
23,636 KB
testcase_18 AC 58 ms
21,720 KB
testcase_19 AC 57 ms
23,692 KB
testcase_20 AC 58 ms
21,816 KB
testcase_21 AC 58 ms
23,712 KB
testcase_22 AC 58 ms
21,752 KB
testcase_23 AC 58 ms
21,832 KB
testcase_24 AC 57 ms
19,604 KB
testcase_25 AC 58 ms
21,648 KB
testcase_26 AC 267 ms
29,976 KB
testcase_27 AC 117 ms
26,016 KB
testcase_28 AC 165 ms
27,668 KB
testcase_29 AC 117 ms
30,152 KB
testcase_30 AC 166 ms
27,536 KB
testcase_31 AC 138 ms
26,968 KB
testcase_32 AC 98 ms
25,268 KB
testcase_33 AC 230 ms
29,264 KB
testcase_34 AC 264 ms
29,980 KB
testcase_35 AC 72 ms
25,704 KB
testcase_36 AC 71 ms
25,656 KB
testcase_37 AC 82 ms
26,472 KB
testcase_38 AC 95 ms
23,208 KB
testcase_39 AC 116 ms
28,148 KB
testcase_40 AC 142 ms
26,796 KB
testcase_41 AC 166 ms
27,612 KB
testcase_42 AC 196 ms
28,368 KB
testcase_43 AC 235 ms
29,172 KB
testcase_44 AC 263 ms
32,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.Collections.Generic;
using static System.Console;
using System.Linq;

class yuki302
{
    static void Main()
    {
        var a = int.Parse(ReadLine());
        var b = ReadLine().ToCharArray().Select(c => c - '0').ToArray();

        var key = 1000000007;
        var less = new long[a][];
        for (var i = 0; i < a; ++i) less[i] = new long[b.Length];

        var equal = b.Length - 1;
        for (var c = 1; c < b[0]; ++c) less[c][0] = b.Length - 1;
        for (var i = 1; i < b.Length; ++i)
        {
            for (var c = 0; c < a; ++c) for (var pc = 0; pc < a; ++pc) less[c][i] = (less[c][i] + less[pc][i - 1]) % key;
            for (var c = 1; c < a; ++c) less[c][i] = (less[c][i] + b.Length - i - 1) % key;
            for (var c = 0; c < b[i]; ++c) less[c][i] = (less[c][i] + equal) % key;
        }
        var res = 0L;
        for (var c = 0; c < less.Length; ++c) res = (res + less[c].Last()) % key;
        res = (res + equal) % key;
        WriteLine(res);
    }
}
0