알고리즘/삼성 SW expert Academy

[SWEA] 2027. 대각선 출력하기_JAVA

뇌장하드 2022. 5. 4. 20:19

 

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

 

 

SW Expert Academy

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

swexpertacademy.com

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 
import java.util.Scanner;
import java.io.FileInputStream;
 
class Solution
{
    public static void main(String args[]) throws Exception
    {
        for(int i=0;i<5;i++) {     
            String[] array_word;
            String result = "";
               String str="+++++";
                array_word = str.split("");
             array_word[i]="#";
            for(int j=0;j<array_word.length;j++){
            result+=array_word[j];
            }
            System.out.println(result);
        }
    }
}
cs