結果
| 問題 |
No.5 数字のブロック
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-04-21 23:53:10 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 490 bytes |
| コンパイル時間 | 437 ms |
| コンパイル使用メモリ | 54,744 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-21 06:10:14 |
| 合計ジャッジ時間 | 2,706 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 32 WA * 2 |
ソースコード
#include <iostream>
int main(void)
{
int N, L;
std::cin >> L >> N;
int a[N];
for(int i = 0; i < N; i ++)
{
std::cin >> a[i];
}
for(int i = 0; i < N; i ++)
{
for(int j = N - 1; j > i; j --)
{
if(a[j] < a[j - 1])
{
int buff = a[j];
a[j] = a[j - 1];
a[j - 1] = buff;
}
}
}
int sum = 0;
int count = 0;
do
{
sum += a[count];
count ++;
}
while(sum < L);
if(sum > L)
{
count --;
}
std::cout << count << std::endl;
return 0;
}