結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
ksbaseball
|
| 提出日時 | 2021-04-03 17:13:49 |
| 言語 | C++17(clang) (clang++ 22.1.8 + boost 1.92.0 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 391 bytes |
| 記録 | |
| コンパイル時間 | 2,467 ms |
| コンパイル使用メモリ | 167,480 KB |
| 実行使用メモリ | 9,920 KB |
| 最終ジャッジ日時 | 2026-10-07 14:15:16 |
| 合計ジャッジ時間 | 4,545 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 26 WA * 8 |
コンパイルメッセージ
main.cpp:8:11: warning: variable length arrays in C++ are a Clang extension [-Wvla-cxx-extension]
8 | int b[block];
| ^~~~~
main.cpp:8:11: note: read of non-const variable 'block' is not allowed in a constant expression
main.cpp:6:14: note: declared here
6 | int box, block;
| ^
1 warning generated.
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main()
{
int box, block;
cin >> box; cin >> block;
int b[block];
for(int i = 0; i < block; i++){
cin >> b[i];
}
int total = 0;
int output = 0;
sort(b, b + block);
while(total < box){
total += b[output];
output += 1;
}
cout << output-1 << endl;
return 0;
}
ksbaseball