結果

問題 No.420 mod2漸化式
ユーザー tsuchinaga
提出日時 2019-05-17 09:07:25
言語 Go
(1.23.4)
結果
WA  
実行時間 -
コード長 473 bytes
コンパイル時間 14,425 ms
コンパイル使用メモリ 232,032 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-17 05:48:18
合計ジャッジ時間 17,237 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 5 WA * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
)

func main() {
	var x int
	_, _ = fmt.Scan(&x)

	if x == 0 {
		fmt.Println("1 0")
	} else if x == 31 {
		fmt.Println("1 2147483647")
	} else if x > 31 {
		fmt.Println("0 0")
	} else {
		a := comb420(31-1, x-1)
		b := comb420(31-1, x)
		fmt.Printf("%d %d\n", a+b, (2147483647-1)*a)
	}
}

func comb420(l, r int) int {
	if r == 0 || l == r {
		return 1
	} else if r == 1 {
		return l
	} else {
		return comb420(l-1, r-1) + comb420(l-1, r)
	}
}
0