結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2022-11-03 23:06:06 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 5 ms / 5,000 ms |
コード長 | 460 bytes |
コンパイル時間 | 1,184 ms |
コンパイル使用メモリ | 162,480 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-18 05:15:53 |
合計ジャッジ時間 | 2,159 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 |
ソースコード
#include <bits/stdc++.h> using namespace std; #include <ios> #include <iomanip> #include <iostream> #include <string> #include <algorithm> int main(void){ int a, b; cin >>a>>b; int c=0; vector<int> vec(b); for(int i=0;i<b;i++){ cin >>vec.at(i); } sort(vec.begin(),vec.end()); for(int k=0;k<vec.size();k++){ c=c+vec.at(k); if(c>a){ cout <<k; break; } else if(k==vec.size()-1){ cout <<k+1; } } }