test
原始文件为 cpp 代码,本文是转换后的 Markdown 文件。
#include <cstdio>
#include <iostream>
#include <cmath>
#include <math.h>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
bool getW(int& w);
int main()
{
// freopen("in.txt", "r", stdin);
int T; scanf("%d", &T);
while(T--)
{
int temp;
if(getW(temp))
printf("YES\n");
else
printf("NO\n");
if(T) printf("\n");
}
}
bool getW(int& weight)
{
int lw, ll, rw, rl;
scanf("%d%d%d%d", &lw, &ll, &rw, &rl);
bool b1 = true;
bool b2 = true;
if(lw == 0) b1 = getW(lw);
if(rw == 0) b2 = getW(rw);
weight = lw + rw;
return (lw * ll == rw * rl) && b1 && b2;
}