結果

問題 No.1046 Fruits Rush
ユーザー Maboy
提出日時 2021-06-19 20:14:37
言語 Swift
(6.0.3)
結果
WA  
実行時間 -
コード長 244 bytes
コンパイル時間 1,256 ms
コンパイル使用メモリ 137,080 KB
実行使用メモリ 9,472 KB
最終ジャッジ日時 2024-06-22 22:19:38
合計ジャッジ時間 1,800 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

let n = readLine()!.split(separator: " ").map{Int($0)!}
var a = readLine()!.split(separator: " ").map{Int($0)!}.sorted()
for i in 0...a.count - 1{
    a[i] = a[i] < 0 ? 0 : a[i]
}
var b = 0
for i in a[(a.count - n[1])...]{
    b += i
}
print(b)
0