結果
| 問題 |
No.58 イカサマなサイコロ
|
| ユーザー |
|
| 提出日時 | 2016-02-27 23:23:42 |
| 言語 | Go (1.23.4) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 686 bytes |
| コンパイル時間 | 12,647 ms |
| コンパイル使用メモリ | 233,736 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-10 23:06:21 |
| 合計ジャッジ時間 | 14,674 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 8 WA * 2 |
ソースコード
package main
import (
"bufio"
"fmt"
"math/rand"
"os"
"strconv"
"time"
)
var sc = bufio.NewScanner(os.Stdin)
func main() {
sc.Split(bufio.ScanWords)
n, k := nextInt(), nextInt()
r := rand.New(rand.NewSource(time.Now().UnixNano()))
yW, tW := 0, 0
for i := 0; i < 1000000; i++ {
y, t := 0, 0
for j := 0; j < n; j++ {
y += r.Intn(6) + 1
}
for j := 0; j < n-k; j++ {
t += r.Intn(6) + 1
}
for j := 0; j < k; j++ {
t += r.Intn(3) + 4
}
if y > t {
yW++
} else if t > y {
tW++
}
}
fmt.Println(float64(tW) / 1000000)
}
func nextLine() string {
sc.Scan()
return sc.Text()
}
func nextInt() int {
i, _ := strconv.Atoi(nextLine())
return i
}