結果

問題 No.129 お年玉(2)
ユーザー fmhrfmhr
提出日時 2015-04-23 06:57:07
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 805 bytes
コンパイル時間 11,308 ms
コンパイル使用メモリ 230,872 KB
実行使用メモリ 392,960 KB
最終ジャッジ日時 2024-04-18 10:33:13
合計ジャッジ時間 24,709 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 2 ms
5,376 KB
testcase_33 AC 10 ms
7,552 KB
testcase_34 AC 5 ms
5,376 KB
testcase_35 AC 9 ms
6,912 KB
testcase_36 AC 10 ms
7,552 KB
testcase_37 AC 12 ms
8,704 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
    "fmt"
)


func pascal( n, m , mod int32) int32 {
    n += 1
    var p [10001][10001]int32
    p[0][0] = 1
    var i, j int32
    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 int32
    mod = 1000000000
    var N, M int32
    fmt.Scan(&N)
    fmt.Scan(&M)
    var a, b, c int32
    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