it shows time limit exceeded…plz help…
#include
using namespace std;
int main()
{
long int n,k,i,count=0,t;
cin>>n;
cin>>k;
for(i=0;i<n;i++)
{
cout<<endl;
cin>>t;
if(t%k==0)
count++;
}
cout<<count;
return 0;
}
it shows time limit exceeded…plz help…
#include
using namespace std;
int main()
{
long int n,k,i,count=0,t;
cin>>n;
cin>>k;
for(i=0;i<n;i++)
{
cout<<endl;
cin>>t;
if(t%k==0)
count++;
}
cout<<count;
return 0;
}
use printf and scanf instead of cout and cin, you will get AC.
printf/scanf is faster than cout/cin or you can use fast i/o method.
Read here.
ur fast io really works !! s29011996