提出 #1422869
ソースコード 拡げる
#include<iostream>
#include<algorithm>
using namespace std;
int n, k, l[50];
int main(void){
cin >> n >> k;
for(int i = 0; i < n; i++){
cin >> l[i];
}
int s = 0;
sort(l, l + n, greater<int>());
for(int i = 0; i < k ; i++){
s += l[i];
}
cout << s << endl;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | B - Snake Toy |
| ユーザ | alex00 |
| 言語 | C++14 (GCC 5.4.1) |
| 得点 | 200 |
| コード長 | 301 Byte |
| 結果 | AC |
| 実行時間 | 1 ms |
| メモリ | 256 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 200 / 200 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 00_example_01.txt, 00_example_02.txt |
| All | 00_example_01.txt, 00_example_02.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 00_example_01.txt | AC | 1 ms | 256 KiB |
| 00_example_02.txt | AC | 1 ms | 256 KiB |
| 01.txt | AC | 1 ms | 256 KiB |
| 02.txt | AC | 1 ms | 256 KiB |
| 03.txt | AC | 1 ms | 256 KiB |
| 04.txt | AC | 1 ms | 256 KiB |
| 05.txt | AC | 1 ms | 256 KiB |
| 06.txt | AC | 1 ms | 256 KiB |
| 07.txt | AC | 1 ms | 256 KiB |
| 08.txt | AC | 1 ms | 256 KiB |