文章
27
粉丝
86
获赞
10
访问
30.4k
C++
首师大人刷首师大机试题
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
int main(){
int T, a, b, c;
vector<int> edges;
cin >> T;
for(int i = 0; i < T; i++){
edges.clear();
cin >> a >> b >> c;
edges.push_back(a);
edges.push_back(b);
edges.push_back(c);
sort(edges.begin(), edges.end(), greater<int>());
if(edges[0] < edges[1] + edges[2]){
if(pow(edges[0], 2) > pow(edges[1], 2) + pow(edges[2], 2)){
cout << 3 << endl;
}
else if(pow(edges[0], 2) < pow(edges[1], 2) + pow(edges[2], 2)){
cout << 1 << endl;
}
else{
cout << 2 << endl;
}
}
else{
cout << -1 << endl;
}
...
登录后发布评论
暂无评论,来抢沙发