結果
問題 | No.825 賢いお買い物 |
ユーザー |
|
提出日時 | 2020-06-04 15:16:44 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 998 bytes |
コンパイル時間 | 12,244 ms |
コンパイル使用メモリ | 377,396 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-29 03:49:59 |
合計ジャッジ時間 | 13,441 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 WA * 5 |
ソースコード
fn read_vec<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() } fn main() { let abc:Vec<i64> = read_vec(); let a = abc[0]; let b = abc[1]; let c = abc[2]; let mut ans = None; for a_use in 0i64..=a { let a_money = a_use; for b_use in 0i64..=b { let b_money = b_use * 10; for price in 1..=100 { let rest = price - a_money - b_money; if rest <= 0 { let t = rest.abs() / 10 + rest.abs() % 10; if a + b - a_use - b_use + t == c { if ans.is_none() { ans = Some(a_money+b_money+rest); } else if ans.unwrap() > a_money+b_money+rest { ans = Some(a_money+b_money+rest); } } } } } } if let Some(ans) = ans { println!("{:?}", ans); } else { println!("Impossible"); } }