結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2018-12-19 19:54:32 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 472 bytes |
コンパイル時間 | 473 ms |
コンパイル使用メモリ | 59,176 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-25 08:07:08 |
合計ジャッジ時間 | 1,877 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 WA * 28 |
ソースコード
#include<iostream> #include<vector> using namespace std; int main() { long long int N, L, min,num; cin >> L >> N; vector<int>W(N); num = 0; for (int i = 0; i<N; i++) { cin >> W[i]; } for (int i = 0; i<N; i++) { for (int j = 0; j<N; j++) { if (W[i]<=W[j]) { min = W[i]; W[i]=10001; } else if(W[i] >= W[j]){ min = W[j]; W[j] = 10001; } } if (L - min >= 0) { L = L - min; num++; } } cout << num << endl; return 0; }