[프로그래머스/Java] Lv.0 짝수 홀수 개수 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 class Solution { public int[] solution(int[] num_list) { int[] answer = new int[2]; //크기가 2인 리턴용 배열 int even=0; //짝수의 개수를 담을 int int odd=0; //홀수의 개수를 담을 int for(int i=0; i [JAVA] 프로그래머스 스쿨/Java Lv.0 2022. 11. 18. 14:10
[프로그래머스/Java] Lv.0 옷가게 할인 받기 1 2 3 4 5 6 7 8 9 10 11 12 class Solution { public int solution(int price) { if(price>=500000) { price*=0.8; } else if(price>=300000) { price*=0.9; } else if(price>=100000) { price*=0.95; } return price; } } Colored by Color Scripter cs [JAVA] 프로그래머스 스쿨/Java Lv.0 2022. 11. 17. 15:20
[프로그래머스/Java] Lv.0 피자 나눠 먹기 (3) 1 2 3 4 5 6 7 8 class Solution { public int solution(int slice, int n) { int answer = 0; int p=(int)Math.ceil((double)n/slice); //인원수를 조각수로 나누고 올림 answer=p; return answer; } } Colored by Color Scripter cs [JAVA] 프로그래머스 스쿨/Java Lv.0 2022. 11. 17. 14:52