結果
| 問題 |
No.58 イカサマなサイコロ
|
| ユーザー |
|
| 提出日時 | 2016-02-27 23:23:08 |
| 言語 | Go (1.23.4) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 736 bytes |
| コンパイル時間 | 11,968 ms |
| コンパイル使用メモリ | 223,928 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-10 23:06:06 |
| 合計ジャッジ時間 | 26,922 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 10 |
ソースコード
package main
import (
"bufio"
"fmt"
"math/rand"
"os"
"strconv"
"time"
)
var sc = bufio.NewScanner(os.Stdin)
var rdr = bufio.NewReaderSize(os.Stdin, 1000000)
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 < 10000000; 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
}