class Solution {
    public int[] solution(int money) {
        //int[] answer = new int[2];
        //answer[0] = money / 5500;
        //answer[1] = money % 5500;
        //return answer;
        return new int[] {money / 5500, money % 5500};
        
    }
}

'공부 > 프로그래머스' 카테고리의 다른 글

각도기  (1) 2024.01.26
배열 뒤집기  (0) 2024.01.26
옷가게 할인 받기  (0) 2024.01.26
배열의 평균값  (2) 2024.01.26
피자 나눠 먹기(3)  (1) 2024.01.26

 

class Solution {
    public int solution(int price) {
        int answer = price;
        if(price >= 500000){
            answer = (int)(price * 0.8);
        }
        else if(price >= 300000){
            answer = (int)(price * 0.9);
        }
        else if(price >= 100000){
            answer = (int)(price * 0.95);
        }
        return answer;
    }
}

'공부 > 프로그래머스' 카테고리의 다른 글

배열 뒤집기  (0) 2024.01.26
아이스 아메리카노  (0) 2024.01.26
배열의 평균값  (2) 2024.01.26
피자 나눠 먹기(3)  (1) 2024.01.26
피자 나눠 먹기(2)  (0) 2024.01.26

 

class Solution {
    public double solution(int[] numbers) {
        double answer = 0;
        for(int num : numbers){
            answer += num;
        }
        answer = answer / numbers.length;
        return answer;
    }
}

'공부 > 프로그래머스' 카테고리의 다른 글

아이스 아메리카노  (0) 2024.01.26
옷가게 할인 받기  (0) 2024.01.26
피자 나눠 먹기(3)  (1) 2024.01.26
피자 나눠 먹기(2)  (0) 2024.01.26
피자 나눠 먹기 (1)  (0) 2024.01.26

 

class Solution {
    public int solution(int slice, int n) {
        return n % slice == 0 ? n / slice : (n / slice) + 1;
    }
}

'공부 > 프로그래머스' 카테고리의 다른 글

옷가게 할인 받기  (0) 2024.01.26
배열의 평균값  (2) 2024.01.26
피자 나눠 먹기(2)  (0) 2024.01.26
피자 나눠 먹기 (1)  (0) 2024.01.26
짝수는 싫어요  (0) 2024.01.25

+ Recent posts