L 清楚姐姐的三角形I
代码
点击查看代码
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
using namespace std;
#define X first
#define Y second
typedef long long LL;
const char nl = '\n';
const int N = 1e6+10;
int n,m;
void solve(){
LL va,vb,vc;
cin >> va >> vb >> vc;
LL a,b,c;
c = (va+vb-vc)/2;
b = (va+vc-vb)/2;
a = (vb+vc-va)/2;
if(a+b<=c||a+c<=b||b+c<=a||a<=0||b<=0||c<=0)cout<< "No" << nl;
else{
cout << "Yes" << nl;
cout << a << " " << b << " " << c << nl;
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
int T;
cin >> T;
while(T --){
solve();
}
//solve();
}
注意
- 判断是否是三角形(最大边小于其余两边之和,三边都是正数)
- 给出的\(v_a,v_b,v_c\)不一定满足题设条件