|
|
вернуться в форумCan't decrease program time (c#) using System; namespace TestOfCSharp { class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); int[] output = new int[N]; for (int c = 0; c < N; c++) { int K = int.Parse(Console.ReadLine()); int counter = 0; for (int j = 1; j <= K; j += counter, counter++) if (j == K) output[c] = 1; } foreach (int c in output) Console.Write("{0} ", c); } } } Re: Can't decrease program time (c#) Послано BillSu 24 апр 2014 08:33 Use formula wisely, not for... |
|
|