結果
問題 |
No.1993 Horse Racing
|
ユーザー |
|
提出日時 | 2022-07-02 20:13:23 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 745 bytes |
コンパイル時間 | 16,383 ms |
コンパイル使用メモリ | 229,472 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-27 17:16:46 |
合計ジャッジ時間 | 17,703 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 23 |
ソースコード
package main import ( "bufio" "fmt" "os" "strconv" ) var sc = bufio.NewScanner(os.Stdin) var out = bufio.NewWriter(os.Stdout) func solve(n int, a []int) float64 { v := 1.0 for _, ai := range a { v *= (1000.0 - float64(ai)) / 1000.0 } d := 1000.0 * (1.0 - v) return d } func main() { buf := make([]byte, 1024*1024) sc.Buffer(buf, bufio.MaxScanTokenSize) sc.Split(bufio.ScanWords) n := nextInt() a := nextIntSlice(n - 1) ans := solve(n, a) PrintFloat64(ans) } func nextInt() int { sc.Scan() i, _ := strconv.Atoi(sc.Text()) return i } func nextIntSlice(n int) []int { s := make([]int, n) for i := range s { s[i] = nextInt() } return s } func PrintFloat64(x float64) { defer out.Flush() fmt.Fprintln(out, x) }