Beat the Spread!
Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 17794   Accepted: 8484

Description

Superbowl Sunday is nearly here. In order to pass the time waiting for the half-time commercials and wardrobe malfunctions, the local hackers have organized a betting pool on the game. Members place their bets on the sum of the two final scores, or on the absolute difference between the two scores. 
Given the winning numbers for each type of bet, can you deduce the final scores? 

Input

The first line of input contains n, the number of test cases. n lines follow, each representing a test case. Each test case gives s and d, non-negative integers representing the sum and (absolute) difference between the two final scores.

Output

For each test case, output a line giving the two final scores, largest first. If there are no such scores, output a line containing "impossible". Recall that football scores are always non-negative integers.

Sample Input

2
40 20
20 40

Sample Output

30 10
impossible

Source

水题,唯一要注意的就是x和y如果一个是偶数一个是奇数也应该impossible,这题在今年的中国地质大学邀请赛上面有一个类似的,不过那个难多了。需要二分
 #include<iostream>
#include<cstdio>
using namespace std; int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
int x,y;
for(int i= ;i<n;i++)
{
scanf("%d%d",&x,&y);
if(x<y||x%==&&y%!=||x%!=&&y%==)
printf("impossible\n");
else
{
int larger = (x+y)/;
int litter = x-larger;
printf("%d %d\n",larger,litter);
}
}
}
return ;
}

poj2301的更多相关文章

  1. POJ2301+水~~~~~~

    有比这更水的么.............. #include<stdio.h> int main(){ int n; scanf("%d",&n); while ...

随机推荐

  1. 2013Q1全球网速排名 韩国第1美国第9 中国呐?(图)

    德国著名统计公司Statista,最近公布了2013 Q1季度全球互联网网速排名数据.其中,韩国以平均14.2Mbps的网速继续排名世界第一. 此外,第二至第十名的国家和地区分别为:日本(11.7 M ...

  2. 用日志文件备份sqlserver

    USE [TestDB] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO )) as ) ),),)),)+ '.bak' backup dat ...

  3. CXF之webservice

    使用 CXF 做 webservice 简单例子     Apache CXF 是一个开放源代码框架,提供了用于方便地构建和开发 Web 服务的可靠基础架构.它允许创建高性能和可扩展的服务,您可以将这 ...

  4. 关于memecache的使用及清楚示意

    Memcache是danga.com的一个项目,最早是为 LiveJournal 服务的,目前全世界不少人使用这个缓存项目来构建自己大负载的网站,来分担数据库的压力.它可以应对任意多个连接,使用非阻塞 ...

  5. NSNotificationCenter 传对象

    [[NSNotificationCenter defaultCenter] postNotificationName:@"postCity" object:pro]; [[NSNo ...

  6. LR实战之Discuz开源论坛——安装及简介

    想了很久,也许是因为这段时间特别闲,从毕业到现在,我的测试职业生涯也近两年了,发现自己越来越喜欢测试领域,也越来越偏向测试开发了,作为一名专业的测试人员,不得不要学习性能测试,而使用LoadRunne ...

  7. BeeswaxException 以及其他问题

    Could not read table BeeswaxException(handle=QueryHandle(log_context='ae18ae74-518f-400b-b4b0-d399ed ...

  8. bach cello

    http://bachlb.blog.163.com/blog/static/1819105120073275251223 一个偶然的机会,卡萨尔斯的父亲来巴塞罗那看卡萨尔斯,并且一起去逛了一间海边的 ...

  9. ThinkPHP框架搭建及常见问题(Apache或MySQL无法启动)----简单的初体验

    有一定基础的人勿进,这篇讲的只是零基础入门,都是我刚接触以及我所了解到的人刚开始有疑惑的地方,具体框架介绍会在后面的博客中介绍 这一篇只是为了一个简单的页面显示而介绍的方法,不涉及代码,开发环境,所以 ...

  10. GYP构建系统总结

    GYP,Generate Your Project,一个Google开源的构建系统,最开始用于Chromium项目,现在一些其他的开源项目也开始使用GYP,如v8和node-gyp.不管怎样,这仅仅是 ...