Created
October 29, 2025 07:11
-
-
Save donma/374e4341a9a934824e28cef1be34d3ad to your computer and use it in GitHub Desktop.
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 characters
| var sp = new Stopwatch(); | |
| sp.Start(); | |
| Parallel.For(1, 10, a => | |
| { | |
| Parallel.For(1, 10, b => | |
| { | |
| Parallel.For(1, 10, c => | |
| { | |
| Parallel.For(1, 10, d => | |
| { | |
| long left = 25870 + a; | |
| int right = (int)Math.Pow(2, b) * c * d * d * 11; // 2^b * c * d² * 11 | |
| if (left == right) | |
| { | |
| Console.WriteLine($"a={a}, b={b}, c={c}, d={d}, sum={left}"); | |
| } | |
| }); | |
| }); | |
| }); | |
| }); | |
| Console.WriteLine(sp.Elapsed); | |
| //a=2, b=3, c=6, d=7, sum=25872 | |
| //a=2, b=4, c=3, d=7, sum=25872 | |
| //00:00:00.0154183 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment