結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
toshiro_yanagi
|
| 提出日時 | 2019-01-27 16:24:02 |
| 言語 | Nim (2.2.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 854 bytes |
| コンパイル時間 | 835 ms |
| コンパイル使用メモリ | 64,048 KB |
| 最終ジャッジ日時 | 2024-11-14 20:48:18 |
| 合計ジャッジ時間 | 1,185 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: Use the new 'sugar' module instead; future is deprecated [Deprecated] /home/judge/data/code/Main.nim(20, 12) Error: undeclared identifier: 'lc'
ソースコード
import future, strutils, algorithm
proc nextString: string =
result = ""
while not endOfFile stdin:
let c = readChar stdin
if c == ' ' or c == "\n"[0]: break
elif c != '\r': add result, c
proc nextInt: int =
parseInt nextString()
let
n = nextInt()
var
A, B = lc[nextInt() | (i <- 0 ..< n), int].sorted(cmp)
win = 0
cnt = 0
proc fight: void =
var miniWin = 0
inc cnt
for i in 0 ..< n:
if A[i] > B[i]:
inc miniWin
else:
dec miniWin
if miniWin > 0:
inc win
proc main: void =
fight()
while B.nextPermutation:
fight()
while A.nextPermutation:
sort(B, cmp)
fight()
while B.nextPermutation:
fight()
echo((win / cnt).formatFloat(ffDecimal, 2))
when isMainModule:
main()
toshiro_yanagi