using System; public class Program { public static void Main() { string lines = Console.ReadLine(); string[] splitLines = lines.Split(' '); int n = int.Parse(splitLines[0]); int k = int.Parse(splitLines[1]); int[] t = new int[n]; int output = 0; for(int i = 0; i < n; i++) { t[i] = int.Parse(Console.ReadLine()); } foreach(int i in t) { if(i % k == 0) { output++; } } Console.WriteLine(output); } }

I’m now officially addicted to CodeChef. These problems are so much fun. This is my solution to another beginner problem. In this one, the user inputs two integers separated by a space(hints the split with a ‘ ‘ on line 8). The first integer is ‘n’ and it indicates how many numbers are going to be tested. The second integer is ‘k’ and this is going to be used to find out if each subsequent integer is a multiple of ‘k’.

Here’s a link to the problem.