작성일 :

문제 링크

31614번 - 分 (Minutes)

설명

주어진 시와 분을 분 단위로 환산해 출력하는 문제입니다.


접근법

총 분은 60 × H + M입니다. 그대로 계산하여 출력하면 됩니다.


Code

C#

1
2
3
4
5
6
7
8
9
using System;

class Program {
  static void Main() {
    var h = int.Parse(Console.ReadLine()!);
    var m = int.Parse(Console.ReadLine()!);
    Console.WriteLine(60 * h + m);
  }
}

C++

1
2
3
4
5
6
7
8
9
10
11
12
#include <bits/stdc++.h>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int h, m; cin >> h >> m;
  cout << 60 * h + m << "\n";

  return 0;
}