[BOJ 1515] ์์ด์ด์ฐ๊ธฐ
1. ๋ฌธ์ : https://www.acmicpc.net/problem/1515
2. ํ์ด
ํ๋๋ผ๋ ๋งค์นญ๋๋ฉด๋์ด๊ฐ๋๊ฒ ์ค์ํ๋ค
ํฌ์ธํฐ๊ฐ ๋๊ฐ ํ์ํ ๊ฒ๋
3. ์ฝ๋
package baekjoon;
import java.util.*;
import java.io.*;
public class ์์ด์ด์ฐ๊ธฐ {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String num = br.readLine();
int pt = 0;
int base = 0;
while (base <= 30000) {
base++;
String baseStr = String.valueOf(base);
for (int i = 0; i < baseStr.length(); i++) {
if (baseStr.charAt(i) == num.charAt(pt))
pt++;
if (pt == num.length()) {
System.out.println(base);
return;
}
}
}
}
}
'๐ป Coding Problems Solving > Two Pointers | Binary Search| LinkedList' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[BOJ 2467] ์ฉ์ก (0) | 2023.09.11 |
---|---|
[BOJ 2110] ๊ณต์ ๊ธฐ ์ค์น (0) | 2023.09.06 |
[BOJ 2343] ๊ธฐํ ๋ ์จ (0) | 2023.09.05 |
[BOJ 19637] IF๋ฌธ ์ข ๋์ ์จ์ค (0) | 2023.08.31 |
[BOJ 2512] ์์ฐ (0) | 2023.08.27 |
์ต๊ทผ๋๊ธ