package lanqiaobei;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/*
习题:等边三角形
蒜头君手上有一些小木棍,它们长短不一,蒜头君想用这些木棍拼出一个等边三角形,并且每根木棍都要用到。 例如,蒜头君手上有长度为1,2,3,3 的4根木棍,他可以让长度为1,2 的木棍组成一条边,另外2 跟分别组成2条边,拼成一个边长为3的等边三角形。蒜头君希望你提前告诉他能不能拼出来,免得白费功夫。
输入格式
首先输入一个整数 n(3≤n≤20),表示木棍数量,接下来输入n根木棍的长度 pi(1≤pi≤10000)。
输出格式
如果蒜头君能拼出等边三角形,输出"yes",否则输出"no"。
样例输入1
5
1 2 3 4 5
样例输出1
yes
样例输入2
4
1 1 1 1
样例输出2
no
*/
public class EqTriangle {
public static String res = "no";
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
List<Integer> ls = new ArrayList<>();
int sum = 0;
int ll = 0;
for (int i = 0; i < n; i++) {
int l = sc.nextInt();
习题:等边三角形(java)
最新推荐文章于 2021-06-01 11:00:53 发布