본문 바로가기

Java

(501)
[JAVA] 프로그래머스 - 순서쌍의 개수 https://school.programmers.co.kr/learn/courses/30/lessons/120836 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 정답 class Solution { public int solution(int n) { int answer = 0; //n의 약수 for(int i=1; i
[JAVA] 프로그래머스 - 배열 자르기 https://school.programmers.co.kr/learn/courses/30/lessons/120833 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 정답 class Solution { public int[] solution(int[] numbers, int num1, int num2) { int answer[] = new int[num2-num1+1]; int idx=0; for(int i=num1; i
[JAVA] 프로그래머스 - 양꼬치 https://school.programmers.co.kr/learn/courses/30/lessons/120830 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 정답 class Solution { public int solution(int n, int k) { int answer = 0; int free = n/10; answer = n*12000 + k*2000 - free*2000; return answer; } }
[JAVA] 프로그래머스 - 머쓱이보다 키 큰 사람 https://school.programmers.co.kr/learn/courses/30/lessons/120585 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 정답 class Solution { public int solution(int[] array, int height) { int answer = 0; for(int i=0; iheight) { answer++; } } return answer; } }
[JAVA] 프로그래머스 - 문자 반복 출력하기 https://school.programmers.co.kr/learn/courses/30/lessons/120825 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 정답 class Solution { public String solution(String my_string, int n) { StringBuffer answer = new StringBuffer(); for(int i=0; i
[JAVA] 프로그래머스 - 옷가게 할인 받기 https://school.programmers.co.kr/learn/courses/30/lessons/120818 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 정답 class Solution { public int solution(int price) { double discount = 1.0; if(price>=100000 && price=300000 && price=500000) { discount = 0.8; } double answer = price*discount; return (int)answer; } } 다른 사람의 풀이 class Solu..
[JAVA] 프로그래머스 - 피자 나눠 먹기(3) https://school.programmers.co.kr/learn/courses/30/lessons/120816 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 정답 class Solution { public int solution(int slice, int n) { int answer = 0; if(n%slice>0) { answer = n/slice+1; } else { answer = n/slice; } return answer; } } 다른 사람의 풀이 class Solution { public int solution(int slice, int ..
[JAVA] 프로그래머스 - 피자 나눠 먹기(2) https://school.programmers.co.kr/learn/courses/30/lessons/120815 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 정답 class Solution { public int solution(int n) { int answer = 0; for(int i=1; i