結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
bubo
|
| 提出日時 | 2018-03-03 21:09:14 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 683 bytes |
| コンパイル時間 | 13,570 ms |
| コンパイル使用メモリ | 391,376 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-18 12:08:06 |
| 合計ジャッジ時間 | 14,934 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
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;
let mut ct = 0;
for w in ws {
match sum + w {
x if x == l => {
ct += 1;
break;
}
x if x > l => {
break;
}
x => {
sum = x;
ct += 1;
}
}
}
println!("{}", ct);
}
bubo