
I need to read a large amount of integers (say, n integers) formatted using the usual decimal notation. What is the fastest way to do it in C(++)?
I've tried the following:
for (i = 0; i < n; i++) scanf("%d", &a);
But it's a bit slower than:
for (i = 0; i < (n >> 2); i++) scanf("%d%d%d%d", &a, &b, &c, &d);
for (i = 0; i < (n & 3) ; i++) scanf("%d", &a);
and the likes.
Is there any tricks or functions to do this? Cheers. 