울음참고 개발공부
article thumbnail
코딩테스트 입문 > 아이스 아메리카노

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

article thumbnail
코딩테스트 입문 > 피자 나눠 먹기 (1)

피자 조각이 7개 ! 사람이 7 명일 때는 1판 필요하고, 14판일 때는 2판 ... 8 명일 때는 2판이 필요하다. n이 7의 배수일 때는 n / 7 , 아닐 때는 ( n / 7 ) + 1 이 된다. 나머지 연산자를 이용 class Solution { public int solution(int n) { int answer = 0; if ( n % 7 == 0 ) { answer = n / 7 ; }else { answer = ( n / 7 ) + 1; } return answer; } }