欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Lintcode——765. Valid Triangle

程序员文章站 2024-03-20 13:03:34
...

判断三角形

三角形两边和大于第三边,两边差小于第三边

代码:

public class Solution {
    /**
     * @param a: a integer represent the length of one edge
     * @param b: a integer represent the length of one edge
     * @param c: a integer represent the length of one edge
     * @return: whether three edges can form a triangle
     */
    public boolean isValidTriangle(int a, int b, int c) {
        // write your code here
        if(a+b>c && a+c>b && b+c>a){
            return true;
        }
        return false;
    }
}