S_pot
백준_if문: 45분빠른 알람 본문
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);
}
}
}
'알고리즘과 자료구조 > 알고리즘' 카테고리의 다른 글
알고리즘_스터디1 : 14503번 로봇 청소기 (0) | 2021.06.23 |
---|