[백준] C# 오븐시계

yewonjune·2025년 2월 7일

백준을 풀어보자

목록 보기
4/12

https://www.acmicpc.net/problem/2525
-> 백준 2525번 링크

[코드]

namespace ConsoleApp1
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string currentTime = Console.ReadLine();
            int cookingTime = int.Parse(Console.ReadLine());

            string[] ct = currentTime.Split();

            int h = int.Parse(ct[0]);
            int m = int.Parse(ct[1]);

            int c = m + cookingTime;

            if(c>=60)
            {
                h = h + c / 60;
                c = c % 60;
                
                if(h>=24)
                {
                    h = h % 24;
                }
            }

            Console.WriteLine("{0} {1}", h, c);

        }
    }
}

뉴비는 변수 이름을 어떻게 해야할지 너무 어렵다.

profile
게임만드는 백수

0개의 댓글