HDU 2039 三角形
阿新 • • 發佈:2018-06-25
cpp 包含 itl align esc cin panel pro end
http://acm.hdu.edu.cn/showproblem.php?pid=2039
Problem Description 給定三條邊,請你判斷一下能不能組成一個三角形。 Input 輸入數據第一行包含一個數M,接下有M行,每行一個實例,包含三個正數A,B,C。其中A,B,C <1000; Output 對於每個測試實例,如果三條邊長A,B,C能組成三角形的話,輸出YES,否則NO。 Sample Input 2 1 2 3 2 2 2 Sample Output NO YES 代碼:
#include <bits/stdc++.h> using namespace std; int main() { int M; cin>>M; for(int i=1;i<=M;i++) { double A,B,C; cin>>A>>B>>C; if(A+B>C&&A+C>B&&B+C>A) cout<<"YES"<<endl; else cout<<"NO"<<endl; } return 0; }
HDU 2039 三角形