-
TriangleStudy/알고리즘 2018. 1. 15. 16:12
음...
https://app.codility.com/demo/results/training5GQMW7-5M7/
public static int solution(int[] A){ int P, Q, R = 0; for(int i = 0; i < A.length - 2; i++ ){ P = A[i]; for(int j = i+1; j < A.length - 1; j++){ Q = A[j]; for(int k = j+1; k < A.length ; k++){ R = A[k]; if (P + Q > R && Q + R > P && R + P > Q){ // System.out.println("P : " + P + ", Q : " + Q + ", R : " + R); return 1; } } } } return 0; }
'Study > 알고리즘' 카테고리의 다른 글
fish (0) 2018.01.19 Brackets (0) 2018.01.18 NumberOfDiscIntersections (0) 2018.01.16 MaxProductOfThree (0) 2018.01.16 Distinct (0) 2018.01.15 MinAvgTwoSlice (0) 2018.01.15 GenomicRangeQuery (0) 2018.01.15 PassingCars (0) 2018.01.12 CountDiv (0) 2018.01.12 MaxCounters (0) 2018.01.12 댓글