#include #include #include #include #include #include #include #include #include #include #include #include #define vll vector #define vvvl vector #define vvl vector> #define VV(a, b, c, d) vector>(a, vector(b, c)) #define VVV(a, b, c, d) vector(a, vvl(b, vll (c, d))); #define re(c, b) for(ll c=0;cmonth[Y]+add(X, Y)) Y++, Z = 1; if(Y>=month.size()) X++, Y = 1; return day(X, Y, Z); } string print_(){ string a = to_string(y), b = to_string(m), c = to_string(d); a += '/'; if(b.size()==1) a+='0'; a+=b; a+='/'; if(c.size()==1) a+='0'; a+=c; return a; } }; struct calender{ ll T_y, T_m, T_d; day INI; vector table; map p; calender(day i, ll y=400, ll d = -1){ T_y = 400, INI = i; init(T_y); T_d = table.size(); } void init(ll T){ day now = INI; ll c = 0; while(now.y!=INI.y+T_y||now.m!=INI.m||now.d!=INI.d){ table.push_back(now); p.emplace(vll{now.y, now.m, now.d}, c); now = now.next(), c++; } } day step(ll num){ day now = table[num%T_d]; return day(now.y+(num/T_d)*T_y, now.m, now.d); } ll passd(day now){ ll py = now.y - INI.y - (now.m==INI.m?now.d>=INI.d?0:1:now.m>INI.m?0:1); ll ret = (py/T_y)*T_d; day target(now.y - (py/T_y)*T_y, now.m, now.d); ret += p.at(vll{target.y, target.m, target.d}); return ret; } }; } using namespace D; int main(int argc, char const *argv[]) { day d = day("2015/01/01"); ll ans = 0; while(d.y==2015){ //std::cout << d.y << " " << d.m << " " << d.d << '\n'; if(d.m==d.d%10+d.d/10) ans++; d = d.next(); } std::cout << ans << '\n'; }