글
백준 2525번 오븐 시계(JAVA, C#)
자바
import java.util.*;
public class Main{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int a, b, c;
a = sc.nextInt();
b = sc.nextInt();
c = sc.nextInt();
int min = 60 * a + b; // 시 -> 분
min += c;
int hour = (min / 60) % 24;
int minute = min % 60;
System.out.println(hour + " " + minute);
}
}
//////////////
C#
using System;
namespace Baekjoon {
class Program {
static void Main() {
string s = Console.ReadLine();
string[] s1 = s.Split();
int a = int.Parse(s1[0]);
int b = int.Parse(s1[1]);
string ss = Console.ReadLine();
int c = int.Parse(ss);
int min = 60 * a + b; // 시 -> 분
min += c;
int hour = (min / 60) % 24;
int minute = min % 60;
Console.WriteLine(hour + " " + minute);
}
}
}
'백준 프로그래밍' 카테고리의 다른 글
백준 2739번 구구단(JAVA, C#) (0) | 2023.02.14 |
---|---|
백준 2480번 주사위 세 개(JAVA, C#) (0) | 2023.02.14 |
백준 2884번 알람 시계(JAVA, C#) (0) | 2023.02.12 |
백준 14681번 사분면(JAVA, C#) (0) | 2023.02.12 |
백준 2753번 윤년(JAVA, C#) (0) | 2023.02.12 |