Triangle

 1         /// <summary>
 2         /// Solution
 3         /// 100/100
 4         /// </summary>
 5         /// <param name="A"></param>
 6         /// <returns></returns>
 7         public static int solution(int[] A)
 8         {
 9             long[] arr = new long[A.Length];
10             for (int i = 0; i < A.Length; i++)
11             {
12                 arr[i] = A[i];
13             }
14             Array.Sort(arr);
15             for (int i = arr.Length - 1; i > 1; i--)
16             {
17                 if (arr[i] < arr[i - 1] + arr[i - 2] && arr[i - 1] < A[i] + arr[i - 2] && arr[i - 2] < arr[i] + arr[i - 1])
18                 {
19                     return 1;
20                 }
21             }
22             return 0;
23         }

 

posted @ 2015-07-25 11:49  叫我霍啊啊啊  阅读(138)  评论(0编辑  收藏  举报