Submission #627935


Source Code Expand

using System;
using System.Collections.Generic;
using System.Linq;

class Program {
    static string ReadLine() { return Console.ReadLine(); }
    static int ReadInt() { return int.Parse(ReadLine()); }
    static int[] ReadInts() { return ReadLine().Split().Select(int.Parse).ToArray(); }
    static string[] ReadStrings() { return ReadLine().Split(); }

    const int MOD = (int)1e9 + 7;

    static int CalcNaive(int n, int k) {
       var dp = new int[n+1, k]; // [駅, 連続して停止した駅数]

       dp[1, 1] = 1;
       for (int i = 2; i <= n; i++) { // i 番目の駅

           // i 番目の駅で停車する
           for (int j = 0; j < k-1; j++) {
               dp[i, j+1] = (dp[i, j+1] + dp[i-1, j]) % MOD;
           }

           // i 番目の駅で停車しない
           for (int j = 0; j < k; j++) {
               dp[i, 0] = (dp[i, 0] + dp[i-1, j]) % MOD;
           }
       }

       int ans = 0;
       for (int i = 1; i < k; i++) {
           ans = (ans + dp[n, i]) % MOD;
       }

       return ans;
    }

    static void Main() {
        var nk = ReadInts();
        int n = nk[0], k = nk[1];

     //   Console.WriteLine(CalcNaive(n, k));

    }
}

Submission Info

Submission Time
Task F - 準急
User noriok
Language C# (Mono 2.10.8.1)
Score 0
Code Size 1238 Byte
Status WA
Exec Time 121 ms
Memory 8356 KB

Judge Result

Set Name All
Score / Max Score 0 / 4
Status
WA × 7
Set Name Test Cases
All 00, 01, 02, 03, 04, 90, 91
Case Name Status Exec Time Memory
00 WA 121 ms 8344 KB
01 WA 110 ms 8272 KB
02 WA 114 ms 8352 KB
03 WA 111 ms 8272 KB
04 WA 116 ms 8272 KB
90 WA 113 ms 8264 KB
91 WA 117 ms 8356 KB