結果
問題 |
No.5 数字のブロック
|
ユーザー |
|
提出日時 | 2019-09-08 16:16:09 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 810 bytes |
コンパイル時間 | 12,448 ms |
コンパイル使用メモリ | 379,196 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-27 15:02:20 |
合計ジャッジ時間 | 14,086 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 7 |
ソースコード
fn getline() -> String { let mut __ret = String::new(); std::io::stdin().read_line(&mut __ret).ok(); return __ret; } fn main() { let l: i32 = getline().trim().parse().unwrap(); let n: i32 = getline().trim().parse().unwrap(); let line = getline(); let blockwidths_string: Vec<_> = line.trim().split(' ').collect(); let mut blockwidths = Vec::new(); for i in 0..n { let ui = i as usize; blockwidths.push(blockwidths_string[ui].parse::<i32>().unwrap()); } blockwidths.sort(); let mut block_count = 0; let mut blockwidth_total = 0; for blockwidth in &blockwidths { if blockwidth + blockwidth_total < l { block_count += 1; blockwidth_total += blockwidth; } } println!("{}", block_count); }