首页 > 其他 > 详细

codeforces 190A Vasya and the Bus

时间:2015-04-02 16:50:26      阅读:96      评论:0      收藏:0      [点我收藏+]
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);
	}
}


codeforces 190A Vasya and the Bus

原文:http://my.oschina.net/sherlocked/blog/395247

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!