언어공부/[BAEKJOON] C#
[ BackJoon C# ] 2525번 오븐 시계
zzerou
2022. 12. 9. 22:43
https://www.acmicpc.net/problem/2525
2525번: 오븐 시계
첫째 줄에 종료되는 시각의 시와 분을 공백을 사이에 두고 출력한다. (단, 시는 0부터 23까지의 정수, 분은 0부터 59까지의 정수이다. 디지털 시계는 23시 59분에서 1분이 지나면 0시 0분이 된다.)
www.acmicpc.net
using System;
namespace Main
{
class Program
{
static void Main(string[] args)
{
string[] time = Console.ReadLine().Split(' ');
int A = int.Parse(time[0]); // 시
int B = int.Parse(time[1]); // 분
int need_t = int.Parse(Console.ReadLine());
B += need_t;
while(B >= 60)
{
A++;
B -= 60;
}
if(A >= 24)
{
A -= 24;
}
Console.WriteLine("{0} {1}", A, B);
}
}
}