本题是比较简单的,有几个坑要注意一下:

1、n==0&&m!=0  时输出 "Impossible" ;

2、n==0&&m==0 时输出 ”0 0“;

2、n>m 时最小值为 n,n<m 时最小值为 m;

3、m==0 时最大值,最小值都为 n;

 #include <iostream>
#include <cstring>
using namespace std; int main (){
int n,m;
while (cin>>n>>m){
if (n==){
if (m==)
cout<<"0 0"<<endl;
else
cout<<"Impossible"<<endl;
continue ;
}
else if (m==)
cout<<n<<" "<<n<<endl;
else
cout<<max (n,m)<<" "<<n+m-<<endl;
}
return ;
}

CodeForces 190A Vasya and the Bus的更多相关文章

  1. CodeForces - 837E - Vasya's Function | Educational Codeforces Round 26

    /* CodeForces - 837E - Vasya's Function [ 数论 ] | Educational Codeforces Round 26 题意: f(a, 0) = 0; f( ...

  2. codeforces B. Vasya and Public Transport 解题报告

    题目链接:http://codeforces.com/problemset/problem/355/B 题目意思:给出四种票种,c1: 某一部bus或者trolley的单程票(暗含只可以乘坐一次):c ...

  3. Codeforces 837E. Vasya's Function

    http://codeforces.com/problemset/problem/837/E   题意: f(a, 0) = 0; f(a, b) = 1 + f(a, b - gcd(a, b)) ...

  4. Codeforces 837E Vasya's Function - 数论

    Vasya is studying number theory. He has denoted a function f(a, b) such that: f(a, 0) = 0; f(a, b) = ...

  5. Codeforces 493C - Vasya and Basketball

    C. Vasya and Basketball 题目链接:http://codeforces.com/problemset/problem/493/C time limit per test 2 se ...

  6. Educational Codeforces Round 11B. Seating On Bus 模拟

    地址:http://codeforces.com/contest/660/problem/B 题目: B. Seating On Bus time limit per test 1 second me ...

  7. Codeforces 1107G Vasya and Maximum Profit 线段树最大子段和 + 单调栈

    Codeforces 1107G 线段树最大子段和 + 单调栈 G. Vasya and Maximum Profit Description: Vasya got really tired of t ...

  8. codeforces 493B.Vasya and Wrestling 解题报告

    题目链接:http://codeforces.com/problemset/problem/493/B 题目意思:给出 n 个 techniques,每个 technique 的值为 ai. ai & ...

  9. codeforces 493A. Vasya and Football 解题报告

    题目链接:http://codeforces.com/contest/493/problem/A 题目意思:给出两个字符串,分别代表 home 和 away.然后有 t 个player,每个playe ...

随机推荐

  1. python之3内置容器

    所谓内置容器,就是不需要第三方模块,就可以使用的. 1.list容器,一个有序序列,类似于数组,但比数组强大很多 1.1.如何初始化list,直接一个[]即可,这是一个空的list >>& ...

  2. 【其他】IT公司的企业文化与竞争力

    一直觉得三流企业靠成本竞争,二流企业靠体制竞争,一流企业靠文化竞争. 企业在竞争时候,总会提到一个词:核心竞争力.对于IT企业来说,核心竞争是什么?无论是技术也好,销售也罢,归根到底还是人才的竞争,优 ...

  3. SCSI接口图文详解

    目前存储设备的接口有五大类:IDE.SCSI.USB,并行口,串口,其中并行口与串口的速度非常慢,不提也罢,最主要的就是IDE,usb,SCSI.IDE(Integrated Drive Electr ...

  4. asm.uew

    /L16"ASM" Nocase Line Comment = ; File Extensions = ASM INC DEF /Colors = ,,,,, /Colors Ba ...

  5. 数据库下载word预览功能的研究

    本文参考了这里的一些方法http://tobetobe.blog.51cto.com/1392243/354420 一直想通过缓存来实现,奈何技术不够,走了曲线救国的思路,先下载,然后预览,删除下载文 ...

  6. Pascal's Triangle II 解答

    Question Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Ret ...

  7. HDOJ-1012 u Calculate e(水)

    http://acm.hdu.edu.cn/showproblem.php?pid=1012 简单套公式 # include <stdio.h> double Factorial(doub ...

  8. Pattern | CLiPS

    Pattern | CLiPS Pattern Pattern is a web mining module for the Python programming language. It has t ...

  9. 学习linux之vi编辑器

    进入vi的命令 vi filename :打开或新建文件,并将光标置于第一行首 vi +n filename :打开文件,并将光标置于第n行首 vi + filename :打开文件,并将光标置于最后 ...

  10. 【转】10个你必须掌握的超酷VI命令技巧

    摘要:大部分Linux开发者对vi命令相当熟悉,可是遗憾的是,大部分开发者都只能掌握一些最常用的Linux vi命令,下面介绍的10个vi命令虽然很多不为人知,但是在实际应用中又能让你大大提高效率. ...