2884번 - 알람 시계
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp3
{
internal class Program
static void Main(string[] args)
string s = Console.ReadLine();
string[] ss = s.Split();
int h = int.Parse(ss[0]);
int m = int.Parse(ss[1]);
if (m < 45)
h -= 1;
m += 60;
if (h <= 0)
h += 24;
}
m -= 45;
Console.WriteLine($"{h} {m}");
반례)
0 45
답:
0 0
댓글을 작성하려면 로그인해야 합니다.
bluestar412 1년 전
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp3
{
internal class Program
{
static void Main(string[] args)
{
{
string s = Console.ReadLine();
string[] ss = s.Split();
int h = int.Parse(ss[0]);
int m = int.Parse(ss[1]);
if (m < 45)
{
h -= 1;
m += 60;
if (h <= 0)
{
h += 24;
}
m -= 45;
}
Console.WriteLine($"{h} {m}");
}
}
}
}