알고리즘과 자료구조/알고리즘
백준_if문: 45분빠른 알람
S_pot
2021. 6. 27. 17:07
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp6
{
class Program
{
static void Main(string[] args)
{
string[] s = Console.ReadLine().Split(' ');
int h = int.Parse(s[0]);
int m = int.Parse(s[1]);
if (h < 0 || h > 24 || m < 0 || m > 59) return;
if (m < 45)
{
h--;
m += 15;
if(h < 0)
{
h = 23;
}
}
else
{
m -= 45;
}
Console.WriteLine("{0} {1}", h, m);
}
}
}