Algorithm/Baekjoon
[백준 알고리즘][자바] 1436번 : 영화감독 숌
hyunipad
2022. 3. 6. 17:13
반응형
https://www.acmicpc.net/problem/1436
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
public class Main {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int N = Integer.parseInt(br.readLine());
int count = 1;
int i = 666;
while(true) {
if(N == count) { // N번째 종말의 숫자가 되면 빠져나감
break;
}else { // 아니면 다음 수를 검사
i++;
}
String i_str = String.valueOf(i);
if(i_str.contains("666")) { // 숫자에 666이 포함되면 카운팅
count++;
}
}
bw.write(String.valueOf(i));
br.close();
bw.flush();
bw.close();
}
}
반응형