Enormous Input Test

#include
using namespace std;
int main()
{
int n,t,i,a,count=0;
long int k;
cin>>n>>k;
i=0;
while(i<n)
{
cin>>a;
if(a%k==0)
count=count+1;
i++;
cout<<count;
}
return 0;
``}why i m getting time limit Time Limit Exceeded

few things i would like to say…

1)You should not just simply copy and paste the code here.Please tell me how one can read this.I went to your profile page to get your code so that i can modify it for you…but seriously no will do that for you. So please either paste it correctly or just simply give us the hyperlink

2)About your code::–Every thing was fine except that you used cin and cout which are slow so use scanf and printf and secondly your code print count at every iteration which is wrong you have to output counting at last.Here is my code

Happy coding!!

If you dont want to use scanf/printf put this just before taking first input/output. Easy to remember if you put it just after int main()

int main(){
ios::sync_with_stdio(false);
.
//Your code goes here
.
.
}

thanks doodle90 i m new to this coding world and getting lot of problems

Happy coding then :slight_smile: :slight_smile: