結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-04-24 09:45:21 |
| 言語 | Rust (1.94.0 + proconio + num + itertools) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 697 bytes |
| 記録 | |
| コンパイル時間 | 2,500 ms |
| コンパイル使用メモリ | 198,908 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-13 02:40:11 |
| 合計ジャッジ時間 | 2,422 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
fn read<T: std::str::FromStr>() -> T {
let mut s = String::new();
std::io::stdin().read_line(&mut s).ok();
s.trim().parse().ok().unwrap()
}
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
let mut s = String::new();
std::io::stdin().read_line(&mut s).ok();
s.trim()
.split_whitespace()
.map(|e| e.parse().ok().unwrap())
.collect()
}
fn main() {
let mut space: i32 = read();
let _num: usize = read();
let mut blocks: Vec<i32> = read_vec();
blocks.sort();
let mut count = 0;
for width in blocks {
if space - width >= 0 {
space -= width;
count += 1;
}
}
println!("{}", count);
}