2525번 - 오븐 시계
string[] AB = Console.ReadLine().Split(" ");
int A = int.Parse(AB[0]);
int B = int.Parse(AB[1]);
int C = Convert.ToInt32(Console.ReadLine());
B += C;
if (B > 59)
{
A += (B / 60);
B %= 60;
if(A >23)
A %= 24;
}
Console.WriteLine($"{A} {B}");
위랑 아래 차이가 뭔지 모르곘습니다.
string[] HM = Console.ReadLine().Split();
int H = int.Parse(HM[0]);
int M = int.Parse(HM[1]);
int Plus = Convert.ToInt32(Console.ReadLine());
M += Plus;
if (M > 59)
H += (M / 60); // H = H+ (M/60);
M %= 60;
if (H >23 )
H %= 24;
Console.WriteLine($"{H} {M}");
댓글을 작성하려면 로그인해야 합니다.
kia946 2년 전
string[] AB = Console.ReadLine().Split(" ");
int A = int.Parse(AB[0]);
int B = int.Parse(AB[1]);
int C = Convert.ToInt32(Console.ReadLine());
B += C;
if (B > 59)
{
A += (B / 60);
B %= 60;
if(A >23)
A %= 24;
}
Console.WriteLine($"{A} {B}");
위랑 아래 차이가 뭔지 모르곘습니다.
string[] HM = Console.ReadLine().Split();
int H = int.Parse(HM[0]);
int M = int.Parse(HM[1]);
int Plus = Convert.ToInt32(Console.ReadLine());
M += Plus;
if (M > 59)
{
H += (M / 60); // H = H+ (M/60);
M %= 60;
if (H >23 )
H %= 24;
}
Console.WriteLine($"{H} {M}");
위에는 틀렸다 나오고 아래는 맞았다고 나오는데 무슨 차이인지 모르겠네요....