Created
January 5, 2015 00:30
-
-
Save omas/7feaa806802a55ecfca4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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