Created
April 26, 2023 18:25
-
-
Save gkucmierz/56cedbbaf9e9b93b51ab0b93c0ca5e16 to your computer and use it in GitHub Desktop.
Revisions
-
gkucmierz created this gist
Apr 26, 2023 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ // https://youtu.be/HDre_o2qz1o?t=238 // Dziadek i babcia mają razem 126 lat, a dziadek ma dwa razy tyle, // ile babcia miała wtedy kiedy dziadek miał tyle ile babcia ma obecnie. // Ile lat ma babcia? const test = (x, diff) => { const bago = x; const d = bago * 2; const b = bago + diff; const dago = b; return dago + diff === d ? [d, b, d + b] : []; }; for (let i = 0; i < 100; ++i) { for (let j = 0; j < 100; ++j) { const [d, b, res] = test(i, j); if (res === 126) { console.log(d, b, res); } } }