4 条题解
- 1
信息
- ID
- 156
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 2
- 标签
- 递交数
- 216
- 已通过
- 129
- 上传者
#include <iostream>
using namespace std;
int main()
{
int a,b,h;
cin >> a >> b >> h;
if (((a+b) >h)&&((b+h)>a)&&((a+h)>b))//这里要用并且&&判断
cout << "yes";
else
cout << "no";
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a[5];
cin>>a[1]>>a[2]>>a[3];
sort(a+1,a+4);
if (a[1]+a[2]>a[3])
{
cout<<"yes";
}
else
{
cout<<"no";
}
return 0;
}
直接排序
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if (a + b > c && a + c > b && b + c > a) {
cout << "yes";
}
else {
cout <<"no";
}
return 0;
}