結果
問題 | No.133 カードゲーム |
ユーザー |
|
提出日時 | 2018-03-06 23:58:18 |
言語 | Go (1.22.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 945 bytes |
コンパイル時間 | 11,731 ms |
コンパイル使用メモリ | 231,568 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-22 03:37:05 |
合計ジャッジ時間 | 12,826 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
ソースコード
/// // File: 133.go // Author: ymiyamoto // // Created on Tue Mar 6 23:44:21 2018 // package main import ( "fmt" ) var N int func perm(arr []int) [][]int { if len(arr) == 0 { return [][]int{} } per := perm(arr[1:]) var ret [][]int for _, val := range per { tmp := make([]int, len(val)) copy(tmp, val) for i := 0; i <= len(tmp); i++ { tmp = append(tmp, 0) copy(tmp[:i+1], tmp[:i]) tmp[i] = arr[0] ret = append(ret, tmp) } } return ret } func main() { fmt.Scan(&N) A := make([]int, N) B := make([]int, N) for i := 0; i < N; i++ { fmt.Scan(&A[i]) } for i := 0; i < N; i++ { fmt.Scan(&B[i]) } permA := perm(A) permB := perm(B) var winB, winA int for i := 0; i < len(A); i++ { var a, b int for j := 0; j < N; j++ { if permA[i][j] > permB[i][j] { a++ } else { b++ } } if a < b { winB++ } else { winA++ } } fmt.Println(float64(winA) / float64(winA+winB)) }