fn read() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } // 標準入力から一行を読み取り、空白文字で分割し、各要素を指定の型に変換する関数 fn read_vec() -> Vec { read::().split_whitespace() .map(|e| e.parse().ok().unwrap()).collect() } fn read_vec2(n: u32) -> Vec> { (0..n).map(|_| read_vec()).collect() } fn main() { let v = read_vec::(); let (a, b, c) = (v[0], v[1], v[2]); let money = a + 10 * b; let howManyCoins = a + b; let deltaCoins = howManyCoins - c; if deltaCoins < -9 { println!("Impossible"); return }else if deltaCoins >= -9 && deltaCoins < 0{ println!("{}", 10 + deltaCoins); }else if deltaCoins == 0 { println!("{}", 0); }else if deltaCoins > 0{ for i in 0..deltaCoins{ let j = deltaCoins - i; if i <= b && j <= a{ println!("{}",i*10+j); return } } println!("Impossible"); } }