Programming/BaekJoon
[C++] 백준 1476번 : 날짜 계산
TCBE
2019. 2. 18. 17:11
https://www.acmicpc.net/problem/1476
#include <iostream>
using namespace std;
int main() {
int E, S, M;
cin >> E >> S >> M;
int year = 1;
int E_s = 1, S_s = 1, M_s = 1;
while (1) {
if ((E_s == E) && (S_s == S) && (M_s == M)) break;
else year++;
E_s++;
S_s++;
M_s++;
if (E_s == 16) E_s = 1;
if (S_s == 29) S_s = 1;
if (M_s == 20) M_s = 1;
}
cout << year << "\n";
}