結果

問題 No.1877 俺自身が線グラフになることだ
ユーザー 👑 kakel-sankakel-san
提出日時 2023-10-09 13:40:25
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 552 bytes
コンパイル時間 891 ms
コンパイル使用メモリ 63,324 KB
実行使用メモリ 22,788 KB
最終ジャッジ日時 2023-10-09 13:40:28
合計ジャッジ時間 2,688 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
20,628 KB
testcase_01 AC 53 ms
20,696 KB
testcase_02 AC 54 ms
20,692 KB
testcase_03 AC 55 ms
22,688 KB
testcase_04 AC 54 ms
22,788 KB
testcase_05 AC 52 ms
20,780 KB
testcase_06 AC 52 ms
20,684 KB
testcase_07 AC 53 ms
20,692 KB
testcase_08 AC 54 ms
22,680 KB
testcase_09 AC 53 ms
20,668 KB
testcase_10 AC 53 ms
20,636 KB
testcase_11 AC 61 ms
20,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

class Program
{
    static int NN => int.Parse(ReadLine());
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var dp = new long[n + 1];
        dp[0] = 1;
        var mod = 1_000_000_007;
        for (var i = 3; i <= n; ++i)
        {
            for (var j = 0; j + i <= n; ++j) dp[i + j] = (dp[i + j] + dp[j]) % mod;
        }
        WriteLine(dp[n]);
    }
}
0