Enormous Input Test (C++ Problem)

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<=10^7). The next n lines of input contain one positive integer t, not greater than 10^9, each.

Output
Write a single integer to output, denoting how many integers t are divisible by k.

Example

Input:
7 3
1
51
966369
7
9
999996
11

Output:
4

I need help. Here's my amateur code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream>
#include <fstream>
using namespace std;

main(){
	
	ifstream myfile;
	
	myfile.open("intest.txt");
	
	int n=0, k=0, t=0, d=0;
	
	while(! myfile.eof()){

	        myfile >> n >> k;
	
	if((k<=10000000)&&(t<=1000000000)){
		for(int i=1; i<=n; i++){

			myfile >> t;
		
		if(t%k==0){
			d++;
		}
	}
		cout << d;
	}
}
	
	myfile.close();

}


I hope you guys can help me fix my code. :) Thanks!
Last edited on
Topic archived. No new replies allowed.