結果

問題 No.2123 Chalk Breaker
ユーザー ID 21712
提出日時 2024-11-18 13:23:33
言語 Go
(1.23.4)
結果
AC  
実行時間 734 ms / 2,000 ms
コード長 348 bytes
コンパイル時間 13,917 ms
コンパイル使用メモリ 241,556 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-18 13:23:51
合計ジャッジ時間 16,553 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import . "fmt"

var memo =map[int]float64{}

func f(n int) float64 {
	if n==0 {
		return 0
	}
	if n==1 {
		return 1
	}
	if z,ok:=memo[n]; ok{
		return z
	}
	var t float64
	for x:=0;x<=n-1;x++ {
		c1:=f(x)
		c2:=f(n-x-1)
		t+=(c1+c2+1)/float64(n)
	}
	memo[n]=t
	return t
}

func main() {
	var n int
	Scan(&n)
	Printf("%.10f\n", f(n))
}
0