結果
問題 | No.5 数字のブロック |
ユーザー |
![]() |
提出日時 | 2023-04-05 21:45:59 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 623 bytes |
コンパイル時間 | 21,096 ms |
コンパイル使用メモリ | 383,484 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-02 02:48:56 |
合計ジャッジ時間 | 15,919 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 |
ソースコード
fn main() {let l: i32 = read_string().parse().unwrap();let _n: i32 = read_string().parse().unwrap();let mut w: Vec<i32> = read_string().split_whitespace().map(|v| v.parse().unwrap()).collect();w.sort();let mut num: i32 = 0;let mut res: i32 = 0;for v in w {num += v;if num <= l {res += 1;}}println!("{}", res);}fn read_string() -> String {let mut s: String = String::new();std::io::stdin().read_line(&mut s).ok();s.trim().to_string()}