알람시계1 [백준] 알람 시계 [C++, 시간 계산을 어떻게 생각 했을까?] 구현 https://www.acmicpc.net/problem/2884 2884번: 알람 시계 상근이는 매일 아침 알람을 듣고 일어난다. 알람을 듣고 바로 일어나면 다행이겠지만, 항상 조금만 더 자려는 마음 때문에 매일 학교를 지각하고 있다. 상근이는 모든 방법을 동원해보았지만, www.acmicpc.net 코드 #include using namespace std; int time (int h, int m) { if (m - 45 < 0) { if (h == 0 ) { h = 24; } } int result = ((h*60)+m)-45; return result; } int main(void) { ios_base::sync_with_stdio(false); cin.tie(NULL); int h, m; .. 2023. 8. 28. 이전 1 다음