Submission #18391201
Source Code Expand
package main
import (
"bufio"
"fmt"
"os"
"strconv"
)
const (
initialBufSize = 100000
maxBufSize = 10000000
)
var (
sc = bufio.NewScanner(os.Stdin)
wt = bufio.NewWriter(os.Stdout)
)
func gets() string {
sc.Scan()
return sc.Text()
}
func getInt() int {
i, _ := strconv.Atoi(gets())
return i
}
func getInt3() (int, int, int) {
return getInt(), getInt(), getInt()
}
func puts(a ...interface{}) {
fmt.Fprintln(wt, a...)
}
func f(x, y, z int, dp [][][]float64) float64 {
if dp[x][y][z] < 0.0 {
d := float64(x)*(f(x+1, y, z, dp)+1.0) + float64(y)*(f(x, y+1, z, dp)+1.0) + float64(z)*(f(x, y, z+1, dp)+1.0)
dp[x][y][z] = d / float64(x+y+z)
}
return dp[x][y][z]
}
func main() {
sc.Split(bufio.ScanWords)
sc.Buffer(make([]byte, initialBufSize), maxBufSize)
defer wt.Flush()
a, b, c := getInt3()
dp := make([][][]float64, 105)
for i := range dp {
dp[i] = make([][]float64, 105)
for j := range dp[i] {
dp[i][j] = make([]float64, 105)
for k := range dp[i][j] {
if i == 100 || j == 100 || k == 100 {
dp[i][j][k] = 0
} else {
dp[i][j][k] = -1.0
}
}
}
}
puts(f(a, b, c, dp))
}
Submission Info
| Submission Time |
|
| Task |
D - increment of coins |
| User |
mutsuro_626 |
| Language |
Go (1.14.1) |
| Score |
400 |
| Code Size |
1212 Byte |
| Status |
AC |
| Exec Time |
54 ms |
| Memory |
12572 KiB |
Judge Result
| Set Name |
Sample |
All |
| Score / Max Score |
0 / 0 |
400 / 400 |
| Status |
|
|
| Set Name |
Test Cases |
| Sample |
sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt |
| All |
hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt |
| Case Name |
Status |
Exec Time |
Memory |
| hand_01.txt |
AC |
54 ms |
12572 KiB |
| hand_02.txt |
AC |
34 ms |
12516 KiB |
| hand_03.txt |
AC |
52 ms |
12560 KiB |
| hand_04.txt |
AC |
19 ms |
12508 KiB |
| hand_05.txt |
AC |
21 ms |
12512 KiB |
| random_01.txt |
AC |
25 ms |
12508 KiB |
| random_02.txt |
AC |
20 ms |
12488 KiB |
| random_03.txt |
AC |
21 ms |
12500 KiB |
| random_04.txt |
AC |
31 ms |
12508 KiB |
| random_05.txt |
AC |
22 ms |
12488 KiB |
| random_06.txt |
AC |
30 ms |
12512 KiB |
| random_07.txt |
AC |
28 ms |
12508 KiB |
| random_08.txt |
AC |
37 ms |
12516 KiB |
| random_09.txt |
AC |
22 ms |
12508 KiB |
| random_10.txt |
AC |
22 ms |
12508 KiB |
| random_11.txt |
AC |
20 ms |
12484 KiB |
| random_12.txt |
AC |
20 ms |
12504 KiB |
| random_13.txt |
AC |
24 ms |
12524 KiB |
| random_14.txt |
AC |
21 ms |
12508 KiB |
| random_15.txt |
AC |
26 ms |
12504 KiB |
| sample_01.txt |
AC |
20 ms |
12468 KiB |
| sample_02.txt |
AC |
19 ms |
12468 KiB |
| sample_03.txt |
AC |
48 ms |
12552 KiB |
| sample_04.txt |
AC |
26 ms |
12508 KiB |