본문 바로가기
728x90

백준/20001 - 2500032

[백준] 23336번 : A Sorting Problem(JAVA) https://www.acmicpc.net/problem/23336 23336번: A Sorting Problem You are given an array [p[1], p[2], ..., p[n]] where all the numbers in the array are distinct. In addition, the numbers are positive integers between 1 and n. You can only perform the following operations on the array: Pick two indices x and y such that | www.acmicpc.net 풀이 기본적인 2중 for문 버블정렬을 할 시 시간초과가 나온다. 분할정복으로 부분을 나눠서 체크해주면 된다... 2021. 10. 30.
[백준] 23343번 : JavaScript(JAVA) https://www.acmicpc.net/problem/23343 23343번: JavaScript Print the result of the minus operation (x - y) on one Line. If the result is an integer, please print it without the decimal point. If the result is not a number, please print NaN. www.acmicpc.net 풀이 저는 try catch구문을 이용하여 풀었습니다. 물론 Matches랑 정규식을 이용해서 푸는 풀이랑 char형태로 isdigt를 이용한 풀이가 존재할 수도 있지만, 이게 편해서 이렇게 했습니다. 소스코드 import java.io.BufferedRe.. 2021. 10. 30.
[백준] 23278번 : 영화 평가(JAVA) https://www.acmicpc.net/problem/23278 23278번: 영화 평가 스타트링크에는 영화 감상 동아리가 있다. 영화 동아리에는 총 N명의 구성원이 있고, 매주 모여서 영화 한 편을 본다. 영화를 본 뒤, 각 사람은 0보다 크거나 같고, 100보다 작거나 같은 정수로 영 www.acmicpc.net 풀이 입력받은 수들을 정렬한 후, 앞에 l부터 뒤 n-h까지의 합을 double형태로 합한 후에 그 길이만큼 나눠서 평균을 구해주시면 됩니다. 소스코드 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.uti.. 2021. 10. 24.
[백준] 23276번 : Locust Locus(JAVA) https://www.acmicpc.net/problem/23276 23276번: Locust Locus The first line of input contains a single integer $k$ ($1 \le k \le 99$), the number of pairs of periodical cicadas. Then follow $k$ lines, each containing three integers $y$, $c_1$ and $c_2$ ($1800 \le y \le 2021$, $1 \le c_1, c_2 \le 99$), the year thi www.acmicpc.net 풀이 왼쪽수 + (가운데수 * 오른쪽수 / 최대공약수(가운데수, 오른쪽수) = 왼쪽수 + 최소공배수(가운데수, 오른쪽수) .. 2021. 10. 22.
728x90