結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
atetubou
|
| 提出日時 | 2019-04-27 14:41:45 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 669 bytes |
| コンパイル時間 | 15,408 ms |
| コンパイル使用メモリ | 400,524 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-27 21:54:16 |
| 合計ジャッジ時間 | 16,863 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
fn read<T: std::str::FromStr>() -> T
where
<T as std::str::FromStr>::Err: std::fmt::Debug,
{
let mut b = String::new();
std::io::stdin().read_line(&mut b).unwrap();
b.trim().parse().unwrap()
}
fn main() {
let mut l: i32 = read();
let _: i32 = read();
let mut b = String::new();
std::io::stdin().read_line(&mut b).unwrap();
let v: Vec<&str> = b.split(' ').collect();
let mut iv: Vec<i32> = vec![];
for x in &v {
iv.push(x.trim().parse().unwrap());
}
iv.sort();
let mut ans: i32 = 0;
for x in iv {
if x <= l {
l -= x;
ans += 1;
}
}
println!("{}", ans)
}
atetubou