Skip to content

Instantly share code, notes, and snippets.

@leaysgur
Created January 18, 2021 14:49
Show Gist options
  • Save leaysgur/9aff5a34881f3ee68806969a1a6f8045 to your computer and use it in GitHub Desktop.
Save leaysgur/9aff5a34881f3ee68806969a1a6f8045 to your computer and use it in GitHub Desktop.
虫食い算
// 2x
// * yz
// =====
// ?3?
// ???
// =====
// ?4?
for (let x = 0; x < 10; x++) {
for (let z = 0; z < 10; z++) {
const t = (20 + x) * z;
const t10 = t / 10 % 10 | 0;
if (t10 === 3) {
for (let y = 1; y < 10; y++) {
const r = (20 + x) * ((y * 10) + z);
const r10 = r / 10 % 10 | 0;
if (r10 === 4 && r < 1000) {
console.log(" 2%s", x);
console.log("* %s%s", y, z);
console.log("=========");
console.log(" %s", t);
console.log(" %s", (20 + x) * y);
console.log("=========");
console.log(" %s", r);
console.log("");
return;
}
}
}
}
}
27
* 35
=========
135
81
=========
945
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment