Post

아이스아메리카노

📃 문제

image


🔨 풀이

1
2
3
4
5
6
7
8
9
10
class Solution {
    public int[] solution(int money) {
        int[] answer = new int[2];
        
        answer[0] = money / 5500;
        answer[1] = money % 5500;   
            
        return answer;
    }
}

money를 5500로 나눠서 최대의 잔 수를 answer의 0번째에 담고

answer의 1번째에는 %로 나눠서 잔돈을 구한다.

This post is licensed under CC BY 4.0 by the author.