結果

問題 No.129 お年玉(2)
ユーザー fmhrfmhr
提出日時 2015-04-23 06:54:06
言語 Go
(1.22.1)
結果
MLE  
実行時間 -
コード長 805 bytes
コンパイル時間 11,086 ms
コンパイル使用メモリ 234,732 KB
実行使用メモリ 784,792 KB
最終ジャッジ日時 2024-04-18 10:36:17
合計ジャッジ時間 47,769 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
50,176 KB
testcase_01 MLE -
testcase_02 AC 3 ms
5,376 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 AC 4 ms
5,376 KB
testcase_05 AC 644 ms
346,172 KB
testcase_06 MLE -
testcase_07 MLE -
testcase_08 MLE -
testcase_09 MLE -
testcase_10 MLE -
testcase_11 MLE -
testcase_12 MLE -
testcase_13 MLE -
testcase_14 MLE -
testcase_15 MLE -
testcase_16 MLE -
testcase_17 MLE -
testcase_18 MLE -
testcase_19 MLE -
testcase_20 MLE -
testcase_21 MLE -
testcase_22 MLE -
testcase_23 MLE -
testcase_24 MLE -
testcase_25 MLE -
testcase_26 MLE -
testcase_27 MLE -
testcase_28 MLE -
testcase_29 AC 3 ms
6,940 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 3 ms
5,376 KB
testcase_32 AC 3 ms
5,376 KB
testcase_33 AC 17 ms
10,240 KB
testcase_34 AC 8 ms
5,632 KB
testcase_35 AC 14 ms
9,344 KB
testcase_36 AC 17 ms
10,496 KB
testcase_37 AC 20 ms
12,416 KB
testcase_38 AC 184 ms
98,688 KB
testcase_39 AC 268 ms
148,096 KB
testcase_40 AC 769 ms
407,808 KB
testcase_41 AC 455 ms
251,648 KB
testcase_42 AC 206 ms
111,488 KB
testcase_43 AC 203 ms
109,568 KB
testcase_44 MLE -
testcase_45 AC 123 ms
63,616 KB
testcase_46 AC 309 ms
164,992 KB
testcase_47 MLE -
testcase_48 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
    "fmt"
)


func pascal( n, m , mod int64) int64 {
    n += 1
    var p [10001][10001]int64
    p[0][0] = 1
    var i, j int64
    for i=1; i<n; i++ {
        for j=0; j<n; j++ {
//            fmt.Println(i,j)
//            fmt.Println(p[i][j])
//            fmt.Println(p[i-1][j-1])
//            fmt.Println(p[i-1][j-1])
            if j == 0 {
                p[i][j] = 1
            } else {
                p[i][j] = (p[i-1][j-1]+p[i-1][j])%mod
            }
        }
    }
    return p[n-1][m]
}

func main() {
    var mod int64
    mod = 1000000000
    var N, M int64
    fmt.Scan(&N)
    fmt.Scan(&M)
    var a, b, c int64
    a = N/1000/M
    b = N - (a * M) * 1000
    c = b/1000
    N /= 1000
    N %= M
//    fmt.Println(M, c)
    fmt.Println(pascal(M, c, mod)%mod)
}
0