Algorithm/BOJ

C#) [BOJ] 5524 입실 관리

HSH12345 2023. 2. 4. 23:00

5524번: 입실 관리 (acmicpc.net)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace _230204_1
{
    class Program
    {
        static void Main(string[] args)
        {
            StreamReader sr = new StreamReader(Console.OpenStandardInput());
            StreamWriter sw = new StreamWriter(Console.OpenStandardOutput());

            int n = int.Parse(sr.ReadLine());
            string[] arr = new string[n];

            for (int i = 0; i < n; i++)
            {
                string name = sr.ReadLine();
                string lowerName = null;

                for (int j = 0; j < name.Length; j++)
                {
                    int ascii = (int)name[j];

                    if (ascii <= 90)
                    {
                        ascii += 32;
                        lowerName += (char)ascii;
                    }
                    else lowerName += (char)ascii;
                }
                arr[i] = lowerName;
            }

            for (int i = 0; i < arr.Length; i++)
            {
                sw.WriteLine(arr[i]);
            }

            sr.Close();
            sw.Close();
        }
    }
}

 

문자룰 정수로 변환할 수 있고 정수(아스키코드)를 문자로 변환할 수 있다면 쉬운문제이다.