[백준 15680] 연세대학교 (C#, C++) - soo:bak
작성일 :
문제 링크
설명
이 문제는 0
또는 1
중 하나의 숫자가 주어졌을 때,
해당 값에 따라 특정 문구를 출력하는 조건 분기 구현 문제입니다.
- 입력이
0
이면"YONSEI"
를 출력 - 입력이
1
이면"Leading the Way to the Future"
를 출력
접근법
- 조건문을 통해 입력이
1
인 경우와 아닌 경우를 구분하여 출력만 잘 해주면 되는 간단한 구현 문제입니다.
Code
[ C# ]
1
2
3
4
5
6
7
8
9
10
using System;
namespace Solution {
class Program {
static void Main(string[] args) {
int num = int.Parse(Console.ReadLine()!);
Console.WriteLine(num == 1 ? "Leading the Way to the Future" : "YONSEI");
}
}
}
[ C++ ]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int num; cin >> num;
if (num) cout << "Leading the Way to the Future\n";
else cout << "YONSEI\n";
return 0;
}