結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2018-03-03 21:02:01 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 660 bytes |
コンパイル時間 | 14,556 ms |
コンパイル使用メモリ | 377,320 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-04 14:32:04 |
合計ジャッジ時間 | 15,555 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 7 |
ソースコード
use std::io::stdin; pub fn main() { let line = || { let mut s = String::new(); let _ = stdin().read_line(&mut s); s }; let l: usize = line().trim().parse().unwrap(); line(); let mut ws: Vec<usize> = line().split_whitespace().flat_map(|x| x.parse()).collect(); ws.sort(); let mut sum = 0; for (i, w) in ws.into_iter().enumerate() { match sum + w { x if x == l => { println!("{}", i + 1); break; } x if x > l => { println!("{}", i); break; } x => sum = x, } } }