๋ฐ์ํ
https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWSNw5jKzwMDFAUr
์ฝ๋
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
// ์ฒซ๋ฒ์งธ, ๋ค์ฏ๋ฒ์งธ ํ
String str1 = "..#..";
String str2 = ".#..";
// ๋๋ฒ์งธ, ๋ค๋ฒ์งธ ํ
String str3 = ".#.#.";
String str4 = "#.#.";
int T = scan.nextInt();
for(int i=0; i<T; i++) {
String str = scan.next();
/* ์ฒซ๋ฒ์งธ ํ */
for(int k=0; k<str.length(); k++) {
if(k == 0) System.out.print(str1);
else System.out.print(str2);
}
System.out.println();
/* ๋๋ฒ์งธ ํ */
for(int k=0; k<str.length(); k++) {
if(k == 0) System.out.print(str3);
else System.out.print(str4);
}
System.out.println();
/* ์ธ๋ฒ์งธ ํ */
for(int k=0; k<str.length(); k++) {
if(k == 0) System.out.print("#." + str.charAt(k) + ".#");
else System.out.print("." + str.charAt(k) + ".#");
}
System.out.println();
/* ๋ค๋ฒ์งธ ํ */
for(int k=0; k<str.length(); k++) {
if(k == 0) System.out.print(str3);
else System.out.print(str4);
}
System.out.println();
/* ๋ค์ฏ๋ฒ์งธ ํ */
for(int k=0; k<str.length(); k++) {
if(k == 0) System.out.print(str1);
else System.out.print(str2);
}
System.out.println();
}
scan.close();
}
}
ํ์ด
๋ฌธ์ ์ถ๋ ฅ์ด 5ํ์ด๋ผ์ ๊ฐ ํ์ ๊ท์น์๋ฐ๋ผ ๊ฐ๊ฐ ์ถ๋ ฅ์ ํ๋ค.
์ฒซ๋ฒ์งธ, ๋ค์ฏ๋ฒ์งธ ํ์ ๊ฒฝ์ฐ ์ฒ์์ "..#.." ๋ก ์์ํ๊ณ , ๊ทธ ์ดํ๋ก ".#.." ๋ก ์์ํ๋ค.
๋๋ฒ์งธ, ๋ค๋ฒ์งธ ํ์ ๊ฒฝ์ฐ ์ฒ์์ ".#.#." ๋ก ์์ํ๊ณ , ๊ทธ ์ดํ๋ก "#.#." ๋ก ์์ํ๋ค.
์ธ๋ฒ์งธ ํ์ ๊ฒฝ์ฐ ์ฒ์์ "#.๋ฌธ์์ด.#" ๋ก ์์ํ๊ณ , ๊ทธ ์ดํ๋ก ".๋ฌธ์์ด.#" ๋ก ์์ํ๋ค.
๋ฐ์ํ
'Algorithm' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[SW Expert Academy] - (D3)8500. ๊ทน์ฅ ์ข์ (0) | 2020.05.26 |
---|---|
[SW Expert Academy] - (D3)9317. ์์ฐฌ์ด์ ๋ฐ์์ฐ๊ธฐ (0) | 2020.05.25 |
[๋ฐฑ์ค] 12790๋ฒ: Mini Fantasy War(๊ตฌํ) (0) | 2020.05.24 |
[๋ฐฑ์ค] 10409๋ฒ: ์๋ฒ (0) | 2020.05.20 |
[๋ฐฑ์ค] 10539๋ฒ: ์๋น์ด์ ์์ด (0) | 2020.05.20 |
๋๊ธ