//#include <bits/stdc++.h>
#include <iostream>
#include <stdio.h>
#include <string>
#include <map>
#include <set>
#include <sstream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <queue>
#include <iomanip>
#include <cmath>
using namespace std;
const int maxv = 10000 + 10;
bool solve(int& w)
{
int w1, d1, w2, d2;
bool b1 = true, b2 = true;
cin >> w1 >> d1 >> w2 >> d2;
if(!w1) b1 = solve(w1);
if(!w2) b2 = solve(w2);
w = w1 + w2;
return b1 && b2 && (w1 * d1 == w2 * d2);
}
int main()
{
int t,W;
cin>>t;
while(t--)
{
if(solve(W))
cout<<"Yes\n";
else
cout<<"No\n";
if(t)
cout<<"\n";
}
return 0;
}
数-----天平 (UVa839)递归
最新推荐文章于 2021-08-12 17:10:18 发布