๋ฐ์ํ
import java.util.Scanner;
// 27866 ๋ฌธ์์ ๋ฌธ์์ด
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String letter = in.nextLine();
char[] arr = letter.toCharArray();
System.out.println(arr[in.nextInt() - 1]);
}
}
- ๋ฌธ์์ด์ ๋ฐฐ์ด๋ก ๋ฐ๊ฟ์ฃผ๋ ํจ์ .toCharArray()๋ง ์ฐพ์ผ๋ ๊ฐ๋จํ์ต๋๋ค.
- ๋ฐฐ์ด์ 0๋ฒ๋ถํฐ ์์ํ๊ธฐ ๋๋ฌธ์ -1๋ก ํด๋น๊ฐ์ ์ฐพ์์ฃผ๋ฉด ๋ฉ๋๋ค.
๋ฐ์ํ
'๐ธ Algorithm > ๐ธ ๋ฐฑ์ค BaekJoon' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค][java][9086][๋ฌธ์์ด] (0) | 2023.12.25 |
---|---|
[๋ฐฑ์ค][java][2743][๋จ์ด ๊ธธ์ด ์ฌ๊ธฐ] (0) | 2023.12.24 |
[๋ฐฑ์ค][java][3052][๋๋จธ์ง] (0) | 2023.11.26 |
[๋ฐฑ์ค][java][1546][ํ๊ท ] (1) | 2023.11.20 |
[๋ฐฑ์ค][java][10811][๋ฐ๊ตฌ๋ ๋ค์ง๊ธฐ] (0) | 2023.11.12 |