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

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. js判断数组和对象

    <script> var arr=new Array(); var obj={'1':2}; var num=11; function isType(obj){ if(obj instan ...

  2. 【转】Apache配置中ProxyPassReverse指令的含义

    此文章来源:http://blog.csdn.net/yl_wh/article/details/8697501 apache中的mod_proxy模块主要作用就是进行url的转发,即具有代理的功能. ...

  3. shell练习--用户下载交互检测

    #!/bin/bash #By spinestars #-- read -p "请输入下载目录路径" down_dir read -p "请输入网址路径" ur ...

  4. mysql在linux上重启

    如何启动/停止/重启MySQL 一.启动方式 1.使用 service 启动:service mysqld start 2.使用 mysqld 脚本启动:/etc/inint.d/mysqld sta ...

  5. 巧用Graphviz和pvtrace等工具可视化C函数调用

    http://guiquanz.github.io/2012/10/15/linux_c_call_trace/

  6. 二维码识别:Halcon与C++中多字节环境下的字节编码格式设置和转换

    Halcon环境下可通过设置set_system(‘filename_encoding’, ‘utf8’),可以将二维码的识别结果解析出汉字. VS环境下则需要将utf8转换成gbk格式.代码如下: ...

  7. poj 1129 Channel Allocation

    http://poj.org/problem?id=1129 import java.util.*; import java.math.*; public class Main { public st ...

  8. 段和RSEG用法

    RSEG是段选择指令,要想明白它的意思就要了解段的意思. 段是程序代码或数据对象的存储单位.程序代码放到代码段,数据对象放到数据段.段分两种,一是绝对段,一是再定位段.绝对段在汇编语言中指定,在用L5 ...

  9. mCustomScrollbar的使用

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8&quo ...

  10. nginx+vaadin配置

    nginx+Vaadin的特殊性在于配置WEBSOCKET或LONG_POLLING.网上资料不多,自己多次尝试配置都不成功,后来终于找到这篇说明才得以配置成功,使用效果不错,介绍如下. 1./etc ...