結果
| 問題 |
No.1011 Infinite Stairs
|
| コンテスト | |
| ユーザー |
c-yan
|
| 提出日時 | 2020-03-21 00:16:52 |
| 言語 | Go (1.23.4) |
| 結果 |
AC
|
| 実行時間 | 83 ms / 2,000 ms |
| コード長 | 944 bytes |
| コンパイル時間 | 14,071 ms |
| コンパイル使用メモリ | 234,816 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-17 11:55:57 |
| 合計ジャッジ時間 | 13,811 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
package main
import (
"bufio"
"fmt"
"os"
"strconv"
)
func main() {
N := readInt()
d := readInt()
K := readInt()
buf0 := make([]int, d*N+K+1)
buf1 := make([]int, d*N+K+1)
buf0[0] = 1
for i := 0; i < N; i++ {
t := 0
for j := 0; j < d; j++ {
t += buf0[j]
t %= 1000000007
buf1[j] = t
}
for j := d; j < (i+1)*d; j++ {
t -= buf0[j-d]
if t < 0 {
t += 1000000007
}
t += buf0[j]
t %= 1000000007
buf1[j] = t
}
buf0, buf1 = buf1, buf0
}
fmt.Println(buf0[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
}
c-yan