알고리즘/백준 문제풀이
백준 2884번, 언어 : C99
ya_ya
2020. 12. 24. 17:56
반응형
#include <stdio.h>
typedef struct Time {
int h; //hour
int m; //minute
} Time;
int main() {
Time t;
scanf("%d %d", &t.h, &t.m);
if (t.m >= 45) {
t.m -= 45;
}
else {
if (t.h == 0) {
t.h = 23;
t.m = t.m + 60 - 45;
}
else {
t.h -= 1;
t.m = t.m + 60 - 45;
}
}
printf("%d %d", t.h, t.m);
return 0;
}
반응형