|
|
back to boardTest # 7 why? Posted by AlexRad 30 Mar 2015 09:37 What is in test #7 ?? Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; var n = int.Parse(Console.ReadLine().Trim()); int a = 0; var p = (int)Math.Truncate(Math.Sqrt(n + n)); while (p > 1) { var s = n - p * (p + 1) / 2; if (s >= 0) { int rem; a = Math.DivRem(s, p, out rem); if (rem == 0) break; } p--; } a++; Console.WriteLine("{0} {1}", a, p); Re: Test # 7 why? Posted by AlexRad 30 Mar 2015 09:41 I got it! [code deleted] Edited by moderator 21.10.2019 23:03 |
|
|