結果

問題 No.420 mod2漸化式
コンテスト
ユーザー tsuchinaga
提出日時 2019-05-17 09:04:42
言語 Go
(1.26.1)
コンパイル:
env GOCACHE=/tmp go build _filename_
実行:
./Main
結果
TLE  
実行時間 -
コード長 440 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 10,499 ms
コンパイル使用メモリ 284,428 KB
実行使用メモリ 1,051,776 KB
最終ジャッジ日時 2026-04-06 03:26:04
合計ジャッジ時間 17,862 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 34 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

package main

import (
	"fmt"
	"math"
)

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

	if x == 0 {
		fmt.Println("1 0")
	} 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, (int(math.Pow(2, 31))-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