190A Vasya and the Bus

简单题,但要仔细分清所有情况,2WA;

# include <cstdio>

int n, m;

void solve(void)
{
    int max, min;

    if (!n && !m) {printf("0 0\n"); return;}
    if (n == 0) {puts("Impossible"); return ;}
    max = m==0 ? n:n+m-1;
    min = (n>=m ? n:m);
    printf("%d %d\n", min, max);
}

int main()
{
    while (~scanf("%d%d", &n, &m))
    {
        solve();
    }

    return 0;
}

posted on 2012-07-13 20:27  getgoing  阅读(131)  评论(0编辑  收藏  举报

导航