백준 2920

Hyerin·2022년 1월 31일
0
post-thumbnail

문제

https://www.acmicpc.net/problem/2920

C# 풀이

using System;
using System.IO;

namespace baekjoon
{
    class Program
    {
        static void Main(string[] args)
        {
            // 표준 입출력 스트림 reader,writer 만들기
            // 문자열 입력받기, 주어지는 값에 따라 결괏값 구하기
            // 버퍼에 저장
            // 버퍼 한 번에 비우기

            StreamReader sr = new StreamReader(Console.OpenStandardInput());
            StreamWriter sw = new StreamWriter(Console.OpenStandardOutput());

            string strInput = sr.ReadLine();
            if (strInput == "1 2 3 4 5 6 7 8")
            {
                sw.WriteLine("ascending");
            }
            else if (strInput == "8 7 6 5 4 3 2 1")
            {
                sw.WriteLine("descending");
            }
            else
            {
                sw.WriteLine("mixed");
            }
            
            sw.Flush();
            sr.Close();
            sw.Close();
        }
    }
}

0개의 댓글