[SW1926] 간단한 369게임
✏️ 𝗔𝗹𝗴𝗼𝗿𝗶𝘁𝗵𝗺/SW Expert Academy

[SW1926] 간단한 369게임

 

 SW Expert Academy - 간단한 369게임 

문제 링크

https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=2&contestProbId=AV5PTeo6AHUDFAUq&categoryId=AV5PTeo6AHUDFAUq&categoryType=CODE&problemTitle=&orderBy=FIRST_REG_DATETIME&selectCodeLang=ALL&select-1=2&pageSize=10&pageIndex=1 

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

문제 입출력

10
1 2 - 4 5 - 7 8 - 10

 

문제 풀이

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;


public class Solution {
	static int ans, N;


	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		N = Integer.parseInt(br.readLine());
		for (int i = 1; i <= N; i++) {
			String str = Integer.toString(i);
			String tmp = "";
			for (char c : str.toCharArray()) {
				if (c == '3' || c == '6' || c == '9') tmp += '-';
			}

			if (tmp.length() >= 1) System.out.print(tmp + " ");
			else System.out.print(str + " ");
		}

	} // end main
}

 

 

 

 

 

 

 

 

 

 

# SWEA 간단한 369게임 알고리즘 # sw 간단한 369게임 java


 

728x90