結果
問題 | No.586 ダブルブッキング |
ユーザー |
|
提出日時 | 2021-11-09 21:12:18 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 620 bytes |
コンパイル時間 | 13,533 ms |
コンパイル使用メモリ | 383,336 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-19 02:28:00 |
合計ジャッジ時間 | 14,441 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 |
ソースコード
fn main() {let p1: u32 = input_line()[0];let p2: u32 = input_line()[0];let n: usize = input_line()[0];let mut rv: Vec<u32> = Vec::new();for _i in 0..n {rv.push(input_line::<u32>()[0]);}rv.sort();let mut cost = 0;for i in 1..n {if rv[i] == rv[i - 1] {cost += p1 + p2;}}println!("{}", cost);}fn input_line<T: std::str::FromStr>() -> Vec<T> {let mut s = String::new();std::io::stdin().read_line(&mut s).ok();s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()}