[백준 27889] 특별한 학교 이름 (C#, C++) - soo:bak
작성일 :
문제 링크
설명
학교 약칭이 주어질 때, 전체 학교명을 출력하는 문제입니다.
NLCS, BHA, KIS, SJA 네 가지 약칭이 주어질 수 있습니다.
접근법
약칭에 따라 대응하는 학교명을 출력합니다.
Code
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
using System;
class Program {
static void Main() {
var s = Console.ReadLine()!;
var ans = s switch {
"NLCS" => "North London Collegiate School",
"BHA" => "Branksome Hall Asia",
"KIS" => "Korea International School",
"SJA" => "St. Johnsbury Academy",
_ => ""
};
Console.WriteLine(ans);
}
}
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
string s; cin >> s;
if (s == "NLCS") cout << "North London Collegiate School\n";
else if (s == "BHA") cout << "Branksome Hall Asia\n";
else if (s == "KIS") cout << "Korea International School\n";
else if (s == "SJA") cout << "St. Johnsbury Academy\n";
return 0;
}