結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
8,080 KB
testcase_01 AC 3 ms
8,208 KB
testcase_02 AC 3 ms
8,176 KB
testcase_03 AC 3 ms
8,136 KB
testcase_04 AC 3 ms
8,324 KB
testcase_05 AC 3 ms
8,084 KB
testcase_06 AC 3 ms
8,136 KB
testcase_07 AC 3 ms
8,252 KB
testcase_08 AC 3 ms
8,064 KB
testcase_09 AC 3 ms
8,060 KB
testcase_10 AC 4 ms
8,204 KB
testcase_11 AC 3 ms
8,164 KB
testcase_12 AC 3 ms
8,092 KB
testcase_13 AC 3 ms
8,192 KB
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]
}
var b = 0
for i in a[(a.count - n[1])...]{
    b += i
}
print(b)
0