import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class CF190A { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String[] nm = in.readLine().split(" "); int n = Integer.parseInt(nm[0]); int m = Integer.parseInt(nm[1]); if (n == 0 && m == 0) { System.out.println(0 + " " + 0); return; } if (n == 0) { System.out.println("Impossible"); return; } if (m == 0) { System.out.println(n + " " + n); return; } int min = 0; if (n > m) { int tn = n; for (int i = 0; i < m; i++) { min += 1; tn -= 1; } min += tn; } else { min = m; } int max = n - 1 + m; System.out.println(min + " " + max); } }
时间: 2024-08-30 05:03:07