Anyway pretty basic stuff:
Input file 10000000 numbers.The first value is the no of numbers and the second is the dividend.
Code:
/* test.cc
g++ test.cc
*/
#include <cstdio>
int main()
{
int x, b, k, divisible;
scanf("%d", &x);
scanf("%d", &b);
while(x--) {
scanf("%d", &k);
if ((k % b) == 0)
++divisible;
}
printf("%d\n", divisible);
}
Time
Code:
128312
real 0m0.828s
user 0m0.812s
sys 0m0.015s
Code:
/* g++ cin.cc */
#include <iostream>
int main()
{
int n, k, read_int, divisible = 0;
std :: cin >> n;
std :: cin >> k;
while (n--) {
std :: cin >> read_int;
if ((read_int % k) == 0)
++divisible;
}
std :: cout <<divisible;
}
Time
Code:
real 0m2.707s
user 0m2.692s
sys 0m0.014s