結果
| 問題 |
No.1046 Fruits Rush
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-06-03 16:11:56 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 235 bytes |
| コンパイル時間 | 922 ms |
| コンパイル使用メモリ | 89,208 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-21 02:19:34 |
| 合計ジャッジ時間 | 1,785 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 WA * 3 |
ソースコード
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
int n,k,a[100];
cin>>n>>k;
for(int i=0;i<n;i++)
cin>>a[i];
sort(a,a+n,greater<>());
int ans=0;
for(int i=0;i<k;i++)
ans+=max(a[i],0);
cout<<ans<<endl;
}