結果
問題 |
No.5 数字のブロック
|
ユーザー |
|
提出日時 | 2024-02-26 01:46:15 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 343 bytes |
コンパイル時間 | 2,162 ms |
コンパイル使用メモリ | 197,536 KB |
最終ジャッジ日時 | 2025-02-19 21:32:56 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 WA * 14 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) int main(){ int l,n; cin>>l>>n; vector<int> w(n); rep(i,n) cin>>w[i]; sort(w.begin(),w.end()); int sum=0,ans=0; int i=0; while(sum<l){ ans=i; sum+=w[i]; i++; } cout<<ans<<endl; return 0; }