• 문제 링크
https://www.acmicpc.net/problem/34845
• 풀이 코드
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
public class Main {
public static void main(String[] args) throws IOException {
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int n = read(), x = read(), sum = 0;
for (int i = 0; i < n; i++) sum += read();
int avg = sum / n, cnt = 0;
while (avg < x) avg = (sum += 100) / (n + ++cnt);
bw.write(String.valueOf(cnt));
bw.flush();
}
private static int read() throws IOException {
int c, n = System.in.read() & 15;
while ((c = System.in.read()) > 32) n = (n << 3) + (n << 1) + (c & 15);
return n;
}
}'Problem Solving > Baekjoon' 카테고리의 다른 글
| [백준] 34619 소대 배정 - Brute Force / Java (0) | 2025.12.06 |
|---|---|
| [백준] 2435 기상청 인턴 신현수 - Brute Force / Java (0) | 2025.12.04 |
| [백준] 15815 천재 수학자 성필 - Data Structure / Java (0) | 2025.12.03 |
| [백준] 22232 가희와 파일 탐색기 - Data Structure / Java (0) | 2025.12.02 |
| [백준] 2161 카드1, 2164 카드2 - Data Structure / Java (0) | 2025.12.01 |
댓글