結果

問題 No.1011 Infinite Stairs
ユーザー c-yanc-yan
提出日時 2020-03-20 22:35:41
言語 Go
(1.22.1)
結果
TLE  
実行時間 -
コード長 802 bytes
コンパイル時間 15,637 ms
コンパイル使用メモリ 224,304 KB
実行使用メモリ 13,316 KB
最終ジャッジ日時 2024-05-08 22:52:32
合計ジャッジ時間 18,462 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
10,752 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 18 ms
5,376 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	N := readInt()
	d := readInt()
	K := readInt()

	t0 := make([]int, d*N+K+1)
	t0[0] = 1
	for i := 0; i < N; i++ {
		t1 := make([]int, d*N+K+1)
		for j := 0; j < i*d+1; j++ {
			for k := 0; k < d; k++ {
				t1[j+k] += t0[j]
				t1[j+k] %= 1000000007
			}
		}
		t0 = t1
	}
	fmt.Println(t0[K-N])
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}
0