• 문제 링크
https://www.acmicpc.net/problem/26753
• 풀이 코드
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));
char[] arr = {'o', 'i', 'j'};
int c, i = 0, cnt = 0;
while ((c = System.in.read()) > 13) {
if (arr[i] == c && ++i == 3) {
i = 0;
cnt++;
}
}
bw.write(cnt > 0 ? String.valueOf(cnt) : "NIE");
bw.flush();
}
}
'Problem Solving > Baekjoon' 카테고리의 다른 글
[백준] 30350 Dviratininkas - Greedy / Java (0) | 2025.08.28 |
---|---|
[백준] 3279 DOLLARS - Greedy / Java (0) | 2025.08.26 |
[백준] 5747 Odd or Even - Greedy / Java (0) | 2025.08.25 |
[백준] 24197 Tabbtabbande - Greedy / Java (0) | 2025.08.24 |
[백준] 27588 Restaurant Opening - Brute Force / Java (0) | 2025.08.23 |
댓글