1476번 - 날짜 계산
완전 탐색
<정답 코드>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #include<iostream> using namespace std; int main() { int E, S, M; cin >> E >> S >> M; int e = 1, s = 1, m = 1; int year = 1; while (e != E || s != S || m != M) { e++, s++, m++, year++; if (e == 16) { e = 1; } if (s == 29) { s = 1; } if (m == 20) { m = 1; } } cout << year << endl; return 0; } | cs |
반응형