题目64 鸡兔同笼

来源:互联网 发布:淘宝客服售前工作内容 编辑:程序博客网 时间:2024/06/05 19:03

     已AC代码:

#include<iostream>using namespace std;int main(){    int t;    cin >> t;    while(t--)    {        int n, m;        cin >> n >> m;        int x, y;        y = (m - 2*n) / 2;        x = n-y;        if(x<0 || y<0 || m%2==1)            cout << "No answer" << endl;        else            cout << x << " " << y << endl;    }    return 0;}


0 0