3 ms·
but that's trival, isn't that already solved? function f(x) { return 28 + maybeLeap(x) + (...); } I remember it's something related with "(x % 4) == 0" an
by _lce0 12y ago
but that's trival, isn't that already solved?
function f(x) { return 28 + maybeLeap(x) + (...); }
I remember it's something related with "(x % 4) == 0" and "not ends_with(00)"
- agrona 12y agoExcept for every 400th year.
- _lce0 12y agohow about this? leap = function(x) { if ((x % 4) != 0) { return 0; } return Number( (x % 100) != 0 || (x % 400) == 0 ); } function(x) { return 28 + leap(x) + (...) };
- joezydeco 12y agoOP is trying to express the day count as a pure math expression. maybeLeap() probably won't do here.