나는 이렇게 학습한다/Algorithm & SQL

1124. Beginner Series #2 Clock

daco2020 2022. 11. 24. 22:37
반응형

Clock shows h hours, m minutes and s seconds after midnight.

Your task is to write a function which returns the time since midnight in milliseconds.

Example:

h = 0
m = 1
s = 1

result = 61000

Input constraints:

  • 0 <= h <= 23
  • 0 <= m <= 59
  • 0 <= s <= 59



Solution:

int past(int h, int m, int s) {
  int hm = h*60+m;
  int ms = hm*60+s;
  int result = ms*1000;
  return result;
}


반응형

'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글

1126. How good are you really?  (0) 2022.11.26
1125. MakeUpperCase  (0) 2022.11.25
1123. L1: Set Alarm  (0) 2022.11.24
1122. Grasshopper - Messi goals function  (0) 2022.11.22
1121. Grasshopper - Grade book  (0) 2022.11.22