Skip to content

Instantly share code, notes, and snippets.

@omas
Created January 5, 2015 00:30
Show Gist options
  • Save omas/7feaa806802a55ecfca4 to your computer and use it in GitHub Desktop.
Save omas/7feaa806802a55ecfca4 to your computer and use it in GitHub Desktop.
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (chunk) {
//console.time('1');
var line = chunk.split('\n')[0].toString();
var result = (function(year) {
var leap = false;
if (year % 4 === 0) leap = true;
if (year % 100 === 0) leap = false;
if (year % 400 === 0) leap = true;
return leap ? "YES" : "NO";
}(parseInt(line,10)));
console.log(result);
//console.timeEnd('1');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment