반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- 자바
- Import
- 알고리즘
- 트리
- 알고리즘 표현
- 좋은 알고리즘
- 리스트
- list
- 프로그래머스
- 알고리즘의 조건 5가지
- Combination
- 유한소수 판별하기
- 유사코드
- 태그
- html
- LV.1
- itertools
- 들여쓰기로 표현한 트리
- 과일 장수
- 코딩테스트
- 스택
- 자료구조
- import itertools
- 코딩 테스트
- 알고리즘의 조건
- python
- 큐
- 파이썬
- java
- Tree
Archives
- Today
- Total
인천의 자유인
[JAVA] 등수 매기기 - 프로그래머스 본문
728x90
반응형
나의 문제 풀이
class Solution {
public int[] solution(int[][] score) {
double[] answer = new double[score.length];
int[] array = new int[score.length];
for (int i = 0; i < score.length; i++){
int total = 0;
for (int j = 0; j < score[i].length; j++){
total += score[i][j];
}
answer[i] = (double)total/2; //total을 명시적 형변환을 해야함!
array[i] = 1;
}
for(int i= 0; i < score.length; i++){
for (int j = 0; j < score.length; j++){
if (answer[i] > answer[j]){
array[j] += 1;
}
}
}
return array;
}
}
728x90
반응형
'JAVA > JAVA코딩테스트' 카테고리의 다른 글
[JAVA] 과일 장수 - 프로그래머스(Lv.1) (2) | 2024.07.23 |
---|---|
[JAVA] 수박수박수박수박수박수? - 프로그래머스(Lv.1) (0) | 2024.06.19 |
[JAVA] A를 B로 만들기 - 프로그래머스 (0) | 2024.04.29 |
[JAVA] 순서쌍의 개수 - 프로그래머스 (0) | 2024.04.23 |
[JAVA] 배열의 평균값 - 프로그래머스 (0) | 2024.04.22 |