結果

問題 No.1046 Fruits Rush
ユーザー taktak
提出日時 2020-06-25 12:39:48
言語 F#
(F# 4.0)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 378 bytes
コンパイル時間 3,489 ms
コンパイル使用メモリ 160,892 KB
実行使用メモリ 25,004 KB
最終ジャッジ日時 2023-09-16 22:36:09
合計ジャッジ時間 6,000 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
20,980 KB
testcase_01 AC 78 ms
24,888 KB
testcase_02 AC 79 ms
20,888 KB
testcase_03 AC 81 ms
24,852 KB
testcase_04 AC 83 ms
22,932 KB
testcase_05 AC 81 ms
25,004 KB
testcase_06 AC 79 ms
20,796 KB
testcase_07 AC 82 ms
23,044 KB
testcase_08 AC 84 ms
23,040 KB
testcase_09 AC 85 ms
22,876 KB
testcase_10 AC 86 ms
22,980 KB
testcase_11 AC 85 ms
23,048 KB
testcase_12 AC 81 ms
20,888 KB
testcase_13 AC 82 ms
22,844 KB
testcase_14 AC 81 ms
22,860 KB
testcase_15 AC 81 ms
22,824 KB
testcase_16 AC 80 ms
22,852 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

open System

let (N, K) = 
    let t = Console.ReadLine().Split() |> Array.map int 
    t.[0], t.[1]

let A = Console.ReadLine().Split() |> Array.map int 

A 
|> Array.sortDescending
|> Array.splitAt 1
|> fun (a, b) -> 
    let t = 
        b
        |> Array.truncate (K - 1) 
        |> Array.where(fun x -> x > 0)
    Array.fold(fun acc x -> acc + x) a.[0] t 
|> printfn "%i"
0