现在的位置: 首页 > 综合 > 正文

hdu1194

2019年02月21日 ⁄ 综合 ⁄ 共 221字 ⁄ 字号 评论关闭
#include<iostream>
using namespace std;
int main()
{
    int t,n,m,p,q,f;
    cin>>t;
    while(t--)
    {
        cin>>n>>m;
        for(p=0;p<=n;p++)
        {
            q=n-p;
            if(q-p==m||q-p==-m)
            break;
        }
        if(p>n)
        cout<<"impossible"<<endl;
        else
        {
            if(q<p)
            {
                f=q;q=p;p=f;
            }
            cout<<q<<' '<<p<<endl;
        }
    }
}

抱歉!评论已关闭.