結果

問題 No.29 パワーアップ
ユーザー chike_pluschike_plus
提出日時 2019-03-26 16:11:02
言語 F#
(5.0)
結果
AC  
実行時間 65 ms / 5,000 ms
コード長 521 bytes
コンパイル時間 3,121 ms
使用メモリ 26,600 KB
最終ジャッジ日時 2022-12-03 22:18:28
合計ジャッジ時間 5,721 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 63 ms
24,732 KB
testcase_01 AC 63 ms
24,592 KB
testcase_02 AC 63 ms
22,400 KB
testcase_03 AC 63 ms
22,568 KB
testcase_04 AC 63 ms
22,428 KB
testcase_05 AC 63 ms
22,608 KB
testcase_06 AC 64 ms
22,620 KB
testcase_07 AC 63 ms
22,416 KB
testcase_08 AC 63 ms
24,564 KB
testcase_09 AC 64 ms
22,500 KB
testcase_10 AC 64 ms
22,456 KB
testcase_11 AC 64 ms
24,628 KB
testcase_12 AC 63 ms
22,584 KB
testcase_13 AC 64 ms
24,460 KB
testcase_14 AC 64 ms
22,488 KB
testcase_15 AC 64 ms
24,472 KB
testcase_16 AC 65 ms
22,480 KB
testcase_17 AC 64 ms
22,356 KB
testcase_18 AC 64 ms
24,464 KB
testcase_19 AC 64 ms
26,600 KB
testcase_20 AC 63 ms
22,376 KB
testcase_21 AC 64 ms
22,500 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

let ``No.29 パワーアップ``() =

  let mutable itemSet = Set.empty
  let mutable powerUp = 0
  [1.. (stdin.ReadLine() |> int) ]
  |> List.iter (fun i ->

    stdin.ReadLine().Split(' ')
    |> Array.map (int)
    |> Array.iter (fun n ->
      if itemSet.Contains n 
        then 
          powerUp <- powerUp + 1
          itemSet <- (itemSet.Remove n)
        else
          itemSet <- (itemSet.Add n)
      )
  )
  powerUp <- powerUp + (itemSet.Count / 4)
  stdout.WriteLine powerUp

``No.29 パワーアップ``()
0