I am trying to test my I/O methods via problem: INTEST http://www.codechef.com/problems/INTEST. On submitting it says time-limit exceeded. I previously submitted the similar problem in C, which gets accepted and takes 1.3 sec but for C++, its going beyond 8 sec. Is there any serious bug in my code or my I/O method is really so bad. Please help guys. As I am trying to switch from C to C++, its really demoralizing. Here is my source code:
#include <iostream>
using namespace std;
int main(){
int test, div;
cin >> test >> div;
int count = 0;
int num;
while(test--){
cin >> num;
count += (num%div ? 0 : 1);
}
cout << count << endl;
return 0;
}