|
|
вернуться в форумC# Solution Послано Serge 13 янв 2018 17:55 //Don't ask me. I don't know. Just work. If anybody can tell me why for (int i = k + 7; i >= 0; i--) and why we needn't n%k - Please, tell! I don't understand. using System; namespace ConsoleApp32 { class Program { static void Main(string[] args) { string[] vvod = Console.In.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); int n = int.Parse(vvod[0]); string k1 = vvod[1]; int k = k1.Length; int q = 1; for (int i = k + 7; i >= 0; i--) { int t; t = n - i * k; if (t > 0) q *= t; } Console.WriteLine(q); } } } Edited by author 13.01.2018 23:49 Re: C# Solution because we have more than 1x! (minimum 2) and less or exactly 9 (because we have 9 numbers 2...10 and it nevermind if we have more !...! than 9). so we have k = 9-2 =7 (maximum) if we use % and the number of '!' is > 10 we have wrong answer, because we have zero: x%y=0 Edited by author 19.03.2023 19:49 |
|
|