The purpose of this problem is to verify whether the method you are using to read input data is sufficiently fast to handle problems branded with the enormous Input/Output warning. You are expected to be able to process at least 2.5MB of input data per second at runtime. Input The input begins with two positive integers n k (n, k<=107). The next n lines of input contain one positive integer ti, not greater than 109, each. Output Write a single integer to output, denoting how many integers ti are divisible by k. Test Case 1 Input (stdin) 7 3 1 51 966369 7 9 999996 11 Expected Output 4 Test Case 2 Input (stdin) 4 1 55 93456 8 1 Expected Output 4
#include <iostream> using namespace std; int main() { int n,i,a[50],m=0,k; cin>>n>>k; for(i=0;i<n;i++) { cin>>a[i]; if(a[i]%k==0) m++; } cout<<m; return 0; }