https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWVWgkP6sQ0DFAUO
SW Expert Academy
SW ํ๋ก๊ทธ๋๋ฐ ์ญ๋ ๊ฐํ์ ๋์์ด ๋๋ ๋ค์ํ ํ์ต ์ปจํ ์ธ ๋ฅผ ํ์ธํ์ธ์!
swexpertacademy.com
์๋ฆฟ์์ ๋ฐฐ์ด์ ํ๋ฐ๋ณตํ๋ for๋ฌธ์ i๋ฒ์๋ฅผ ์กฐ๊ธ ํค๋งจ๊ฑฐ๋นผ๊ณ
๋ฌธ์ ์์ฒด๋ ์ฌ์ ๋ค.
import java.util.Scanner;
class Solution{
public static void main(String args[]) throws Exception{
Scanner kb = new Scanner(System.in);
int T = kb.nextInt();
for (int t = 1; t <= T; t++) {
String[] arr = new String[5];
for (int i = 0; i < 5; i++) {
arr[i] = kb.next();
}
String answer = "";
for (int i = 0; i <15; i++) { // i๋ ์๋ฆฟ์ , j๋ ๋ฌธ์์ด์ ํ
for (int j = 0; j < 5; j++) {
if(i<arr[j].length()){
answer+=arr[j].charAt(i);
}
}
}
System.out.println("#"+t+" "+answer);
}
}
}
'๐ ์ฝ๋ฉํ ์คํธ > ๋ฐฑ์ค & ํ๋ก๊ทธ๋๋จธ์ค' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[SWEA][JAVA]D3 : ์์์ด์ ์ฐ์ ํฉ (0) | 2022.11.15 |
---|---|
[SWEA][JAVA]D3 : ์น๋ฅ ๋น๊ตํ๊ธฐ (0) | 2022.11.15 |
[SWEA][JAVA]D3 : ํผํํธ ์ ํ (0) | 2022.11.14 |
[SWEA][JAVA]D3 : ํ ๋ค์ค์ ํน๋ณํ ์์ (0) | 2022.11.14 |
[SWEA][JAVA]D3 : ๋ฌธ์ ์ ๋ชฉ ๋ถ์ด๊ธฐ (0) | 2022.11.13 |