結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2019-11-21 10:48:21 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 379 bytes |
コンパイル時間 | 1,675 ms |
コンパイル使用メモリ | 169,776 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-09 13:26:32 |
合計ジャッジ時間 | 2,871 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 32 WA * 2 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int (i)=0;(i)<(n);(i)++) #define repi(i,a,b) for(int (i)=(a);(i)<(b);(i)++) using namespace std; int main() { int l,n; cin >> l >> n; int w[n]; rep(i,n){ cin >> w[i]; } sort(w,w+n); int sum=0; int ans=0; int j=0; while(sum<=l){ sum += w[j]; ans++; j++; } cout << ans-1 << endl; return 0; }