작성일 :

문제 링크

25893번 - Majestic 10

설명

입/출력과 조건문에 대한 이해를 확인하는 구현 문제입니다.


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) {

      int.TryParse(Console.ReadLine(), out int cntCase);

      for (int c = 0; c < cntCase; c++) {
        string[]? input = Console.ReadLine()!.Split();

        int cntDouble = 0;
        for (int i = 0; i < 3; i++) {
          if (Convert.ToInt32(input[i]) >= 10)
            cntDouble++;
        }

        string ans = "zilch";
        if (cntDouble == 1)
          ans = "double";
        else if (cntDouble == 2)
          ans = "double-double";
        else if (cntDouble == 3)
          ans = "triple-double";

        Console.WriteLine("{0} {1} {2}\n{3}", input[0], input[1], input[2], ans);
        if (c != cntCase - 1)
          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
33
34
35
36
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int cntCase; cin >> cntCase;
  for (int c = 0; c < cntCase; c++) {
    vector<int> stats(3);

    int cntDouble = 0;
    for (int i = 0; i < 3; i++) {
      cin >> stats[i];
      if (stats[i] >= 10) cntDouble++;
    }

    string ans = "zilch";
    if (cntDouble == 1)
      ans = "double";
    else if (cntDouble == 2)
      ans = "double-double";
    else if (cntDouble == 3)
      ans = "triple-double";

    cout << stats[0] << " " << stats[1] << " " << stats[2] << "\n";
    cout << ans << "\n";
    if (c != cntCase - 1)
      cout << "\n";
    else cout << " ";

  }

  return 0;
}