[백준 24883] 자동완성 (C#, C++) - soo:bak
작성일 :
문제 링크
설명
알파벳 한 글자를 입력받아 조건에 따라 다른 문자열을 출력하는 문제입니다.
접근법
입력이 N 또는 n이면 Naver D2를 출력합니다.
그 외의 경우에는 Naver Whale을 출력합니다.
Code
C#
1
2
3
4
5
6
7
8
using System;
class Program {
static void Main() {
var s = Console.ReadLine()!;
Console.WriteLine((s == "N" || s == "n") ? "Naver D2" : "Naver Whale");
}
}
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
char c; cin >> c;
if (c == 'N' || c == 'n') cout << "Naver D2\n";
else cout << "Naver Whale\n";
return 0;
}