01-10 22:36
Recent Posts
Recent Comments
๊ด€๋ฆฌ ๋ฉ”๋‰ด

miinsun

[BAEKJOON] ๋ฐฑ์ค€ ์ž…์ถœ๋ ฅ 11721 :: ์—ด ๊ฐœ์”ฉ ๋Š์–ด ์ถœ๋ ฅํ•˜๊ธฐ JAVA ๋ณธ๋ฌธ

Algorithm/Baekjoon

[BAEKJOON] ๋ฐฑ์ค€ ์ž…์ถœ๋ ฅ 11721 :: ์—ด ๊ฐœ์”ฉ ๋Š์–ด ์ถœ๋ ฅํ•˜๊ธฐ JAVA

miinsun 2022. 3. 11. 00:27

 

๐Ÿ’ฌ  ๋ฌธ์ œ ์„ค๋ช…

์•ŒํŒŒ๋ฒณ ์†Œ๋ฌธ์ž์™€ ๋Œ€๋ฌธ์ž๋กœ๋งŒ ์ด๋ฃจ์–ด์ง„ ๊ธธ์ด๊ฐ€ N์ธ ๋‹จ์–ด๊ฐ€ ์ฃผ์–ด์ง„๋‹ค.
ํ•œ ์ค„์— 10๊ธ€์ž์”ฉ ๋Š์–ด์„œ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค.

 

 

๐Ÿ”จ  ์ž…์ถœ๋ ฅ ์˜ˆ

์ž…๋ ฅ 

  • ์ฒซ์งธ ์ค„์— ๋‹จ์–ด๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. ๋‹จ์–ด๋Š” ์•ŒํŒŒ๋ฒณ ์†Œ๋ฌธ์ž์™€ ๋Œ€๋ฌธ์ž๋กœ๋งŒ ์ด๋ฃจ์–ด์ ธ ์žˆ์œผ๋ฉฐ, ๊ธธ์ด๋Š” 100์„ ๋„˜์ง€ ์•Š๋Š”๋‹ค.
  • ๊ธธ์ด๊ฐ€ 0์ธ ๋‹จ์–ด๋Š” ์ฃผ์–ด์ง€์ง€ ์•Š๋Š”๋‹ค.

 

์ถœ๋ ฅ

  • ์ž…๋ ฅ์œผ๋กœ ์ฃผ์–ด์ง„ ๋‹จ์–ด๋ฅผ ์—ด ๊ฐœ์”ฉ ๋Š์–ด์„œ ํ•œ ์ค„์— ํ•˜๋‚˜์”ฉ ์ถœ๋ ฅํ•œ๋‹ค.
  • ๋‹จ์–ด์˜ ๊ธธ์ด๊ฐ€ 10์˜ ๋ฐฐ์ˆ˜๊ฐ€ ์•„๋‹Œ ๊ฒฝ์šฐ์—๋Š” ๋งˆ์ง€๋ง‰ ์ค„์—๋Š” 10๊ฐœ ๋ฏธ๋งŒ์˜ ๊ธ€์ž๋งŒ ์ถœ๋ ฅํ•  ์ˆ˜๋„ ์žˆ๋‹ค.

 

์˜ˆ์ œ ์ž…๋ ฅ 1)

BaekjoonOnlineJudge

 

์˜ˆ์ œ ์ถœ๋ ฅ 1)

BaekjoonOn
lineJudge

 

์˜ˆ์ œ ์ž…๋ ฅ 2)

OneTwoThreeFourFiveSixSevenEightNineTen

 

์˜ˆ์ œ ์ถœ๋ ฅ 2)

OneTwoThre
eFourFiveS
ixSevenEig
htNineTen

โ€‹

 

๐Ÿ’ป  Main.java

/* ๋ฐฑ์ค€ ์ž…์ถœ๋ ฅ - 11721 ::์—ด ๊ฐœ์”ฉ ๋Š์–ด ์ถœ๋ ฅํ•˜๊ธฐ */
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		
		int len = s.length();
		System.out.print(s.charAt(0));
		for(int i = 1; i < len; i++) {
			if(i % 10 == 0)
				System.out.println();
			System.out.print(s.charAt(i));
		}		
		sc.close();
	}
}
Comments