algorithm/백준

[백준] 연세대학교 - 15680 Java[자바]

달마루 2023. 3. 11. 23:49


[Bronze IV] 연세대학교 - 15680

문제 링크

 

15680번: 연세대학교

연세대학교의 영문명은 YONSEI, 슬로건은 Leading the Way to the Future이다. 이를 출력하는 프로그램을 작성해보도록 하자.

www.acmicpc.net

성능 요약

메모리: 17424 KB, 시간: 196 ms

분류

구현(implementation)

문제 설명

연세대학교의 영문명은 YONSEI, 슬로건은 Leading the Way to the Future이다.

이를 출력하는 프로그램을 작성해보도록 하자.

입력

첫째 줄에 N이 주어진다. (N = 0 또는 1)

출력

  • N = 0일 경우: 연세대학교의 영문명을 출력한다.
  • N = 1일 경우: 연세대학교의 슬로건을 출력한다.

대소문자 구별에 주의하도록 하자.

 

답 : 입력 받은 값이 0일 때와 아닐 때 각각 값이 나오게한다. 

import java.util.Scanner;

public class Main {
        public static void main(String [] args) {
                Scanner sc = new Scanner(System.in);
                int n = sc.nextInt();

                if(n == 0) {
                        System.out.println("YONSEI"); }
                else {
                        System.out.println("Leading the Way to the Future");
                }
                sc.close();
            }
        }