자윤이와고리즘/Code
[백준] 1476 | 날짜계산
EUJU
2019. 5. 9. 22:18
단순하게 생각하자! 어렵게 말고!
#include <iostream>
using namespace std;
int main() {
int E, S, M;
int e=1, s=1, m=1, cnt = 1;
scanf("%d%d%d", &E, &S, &M);
while (1) {
if (e == E && s == S &&m == M) {
cout << cnt << endl;
break;
}
e++; s++; m++;
if (e == 16)
e = 1;
if (s == 29)
s = 1;
if (m == 20)
m = 1;
cnt++;
}
}