結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2017-03-12 01:54:46 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 406 bytes |
コンパイル時間 | 806 ms |
コンパイル使用メモリ | 69,112 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-24 14:35:30 |
合計ジャッジ時間 | 2,092 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 7 |
ソースコード
#include <iostream> #include <algorithm> using namespace std; int main(void){ long long l = 0; cin >> l; int n; cin >> n; long long *w; w = new long long[n]; for(int i = 0; i < n; ++i){cin >> w[i];} long long cnt = 0; sort(w,w+n); for(int i = 0; i < n; ++i){ l -= w[i]; if(l<=0){break;} cnt++; } cout << cnt << "\n"; return 0; }