You are viewing a single comment's thread. Return to all comments →
Any Suggestions to improve this code?
My Code in C#:
int t = Convert.ToInt32(Console.ReadLine()); for (int a0 = 0; a0 < t; a0++) { string[] tokens_n = Console.ReadLine().Split(' '); int n = Convert.ToInt32(tokens_n[0]); int k = Convert.ToInt32(tokens_n[1]); string[] a_temp = Console.ReadLine().Split(' '); int[] a = Array.ConvertAll(a_temp, Int32.Parse); int present = 0; if (k>n) { Console.WriteLine("YES"); } else { for(int i =0; i<n;i++) { if(a[i]<=0) { present++; } } if (present<k) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } } }
Angry Professor
You are viewing a single comment's thread. Return to all comments →
Any Suggestions to improve this code?
My Code in C#: