codeforces 190A Vasya and the Bus

时间:2015-04-02 16:53:19   收藏:0   阅读:104
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);
	}
}


评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!