[백준 6903] Trident (C#, C++) - soo:bak
작성일 :
문제 링크
설명
* 문자를 이용하여 삼지창 모양을 출력하는 문제입니다. 
Code
[ C# ] 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
namespace Solution {
  class Program {
    static void Main(string[] args) {
      var t = int.Parse(Console.ReadLine()!);
      var s = int.Parse(Console.ReadLine()!);
      var h = int.Parse(Console.ReadLine()!);
      for (int i = 0; i < t; i++) {
        Console.Write("*");
        for (int j = 0; j < s; j++)
          Console.Write(" ");
        Console.Write("*");
        for (int j = 0; j < s; j++)
          Console.Write(" ");
        Console.WriteLine("*");
      }
      for (int i = 0; i < (3 + 2 * s); i++)
        Console.Write("*");
      Console.WriteLine();
      for (int i = 0; i < h; i++) {
        for (int j = 0; j < (1 + s); j++)
          Console.Write(" ");
        Console.WriteLine("*");
      }
    }
  }
}
[ C++ ] 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int t, s, h; cin >> t >> s >> h;
  for (int i = 0; i < t; i++) {
    cout << "*";
    for (int j = 0; j < s; j++)
      cout << " ";
    cout << "*";
    for (int j = 0; j < s; j++)
      cout << " ";
    cout << "*\n";
  }
  for (int i = 0; i < (3 + 2 * s); i++)
    cout << "*";
  cout << "\n";
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < (1 + s); j++)
      cout << " ";
    cout << "*\n";
  }
  return 0;
}