結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
tottoripaper
|
| 提出日時 | 2014-11-16 01:40:37 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 333 bytes |
| 記録 | |
| コンパイル時間 | 283 ms |
| コンパイル使用メモリ | 54,968 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-12 15:46:53 |
| 合計ジャッジ時間 | 1,386 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <cstdio>
#include <algorithm>
int main(){
int L, N;
int W[10000];
scanf("%d %d", &L, &N);
for(int i=0;i<N;i++){scanf("%d", W+i);}
std::sort(W, W+N);
int sum = 0, n = 0;
for(int i=0;i<N;i++){
if(sum + W[i] <= L){sum += W[i]; n += 1;}
}
printf("%d\n", n);
}
tottoripaper