結果
| 問題 |
No.5 数字のブロック
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-04-21 20:41:43 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 480 bytes |
| コンパイル時間 | 561 ms |
| コンパイル使用メモリ | 55,752 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-20 05:12:06 |
| 合計ジャッジ時間 | 2,715 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 WA * 12 |
ソースコード
#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(count < N)
{
count --;
}
std::cout << count << std::endl;
}