結果

問題 No.1046 Fruits Rush
ユーザー MaboyMaboy
提出日時 2021-06-19 20:13:03
言語 Swift
(5.10.0)
結果
WA  
実行時間 -
コード長 249 bytes
コンパイル時間 3,107 ms
コンパイル使用メモリ 135,364 KB
実行使用メモリ 8,348 KB
最終ジャッジ日時 2023-09-05 01:12:58
合計ジャッジ時間 2,881 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
8,144 KB
testcase_01 AC 4 ms
8,084 KB
testcase_02 AC 3 ms
8,140 KB
testcase_03 AC 3 ms
8,268 KB
testcase_04 AC 3 ms
8,256 KB
testcase_05 AC 4 ms
8,164 KB
testcase_06 AC 3 ms
8,088 KB
testcase_07 AC 3 ms
8,180 KB
testcase_08 AC 3 ms
8,084 KB
testcase_09 AC 4 ms
8,208 KB
testcase_10 AC 3 ms
8,160 KB
testcase_11 AC 3 ms
8,172 KB
testcase_12 AC 4 ms
8,204 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

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]
}
a[0] = 0
for i in a[(a.count - n[1])...]{
    a[0] += i
}
print(a[0])
0