#include #ifdef SHO_LOCAL #include "debug.h" #else #define debug(...) \ {} #endif using namespace std; pair tomorrow(int m, int d) { int lim = 31; if (m == 2) lim = 28; if (m == 4 || m == 6 || m == 9 || m == 11) lim = 30; int nd = ++d; if (nd > lim) { m++; nd = 1; } if (m > 12) { m = 1; } return make_pair(m, nd); } int main() { iostream::sync_with_stdio(0), cin.tie(0), cout.tie(0); int m, d, k; cin >> m >> d >> k; vector> days(1, {m, d}); for (int i = 0; i < 6; i++) { days.push_back(tomorrow(days.back().first, days.back().second)); } set st; for (int i = 0; i < 7; i++) { auto [month, day] = days[i]; for (int j = 0; j < 2; j++) { int cnt = 2; while (cnt > 0) { st.insert(month % 10); month /= 10; cnt--; } swap(month, day); } } bool ok = (int)st.size() >= k; cout << (ok ? "Yes" : "No") << '\n'; return 0; }