category/백준 알고리즘 c++
백준 알고리즘 2884번 알람 시계 c++
자운대고라니
2020. 12. 3. 16:05
반응형
요약 : 시간과 분을 입력받으면 -45분 한 시간을 출력하는 문제
소스코드
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#include <iostream>
using namespace std;
int main(void) {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int a,b;
cin >> a >> b;
if(a!=0) {
if(b<45) cout << a-1 << " " << b+15 << endl;
else cout << a << " " << b-45 << endl;
}
else {
if(b<45) cout << "23" << " " << b+15 << endl;
else cout << a << " " << b-45 << endl;
}
return 0;
}
|
cs |
정답 확인
반응형