Skip to content

Instantly share code, notes, and snippets.

@torus
Created August 27, 2011 01:45
Show Gist options
  • Save torus/1174848 to your computer and use it in GitHub Desktop.
Save torus/1174848 to your computer and use it in GitHub Desktop.
// http://community.topcoder.com/stat?c=problem_statement&pm=11509
var results = {};
for (var i in a) {
for (var j in b) {
for (var k in c) {
var val = a[i] + b[j] + c[k];
var origval = val;
while (val % 10 == 5 || val % 10 == 8) {val = (val / 10)|0}
if (val == 0) {console.log(origval, i, j, k);results[origval] = true}
}}}
var dest = 0; for (var i in results) {dest++}; console.debug(dest)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment