Love丶FFC's Blog
给出三个整数 a
, b
, c
, 如果它们可以构成三角形,返回 true
.
三角形的定义 (Wikipedia)
样例 1:
输入 : a = 2, b = 3, c = 4
输出 : true
样例 2:
输入 : a = 1, b = 2, c = 3
输出 : false
1.使用三角形定义。
2.使用条件表达式+if判断。
package LintCode_Easy; public class _765{ public static void main(String[] args) { int a = 2, b = 3, c = 4; boolean judge; if (Math.max(Math.max(a, b), c) == a) { judge = (b+c>a)?true:false; } else if (Math.max(Math.max(a, b), c) == b) { judge = (a+c>b)?true:false; } else { judge = (a+b>c)?true:false; } System.out.println(judge); } }
public class Solution { public boolean isValidTriangle(int a, int b, int c) { boolean judge; if (Math.max(Math.max(a, b), c) == a) { judge = (b+c>a)?true:false; } else if (Math.max(Math.max(a, b), c) == b) { judge = (a+c>b)?true:false; } else { judge = (a+b>c)?true:false; } return judge; } }
fruinly
where to buy cialis cheap In the Victimization Scale, participants were asked to answer how often their mates victimized them while in the Bullying Scale they were asked to answer how often they did bullying behaviors
FoorryNox
These are listed below according to the WHO groupings; Africa, Americas, Eastern Mediterranean EM, South East Asia SEA and Western Pacific WP Table 1 priligy review members 1 Live birth rate per couple Show forest plot
Preliaf
Hagos GK et al 2007 Colon cancer chemoprevention by a novel NO chimera that shows anti inflammatory and antiproliferative activity in vitro and in vivo buying cialis online safe