2011/12/21 Nikhil <[email protected]>:
> ok
> using loop but without using any predifine functioin. What would be
> the best answer of the problem???
It seems straightforward, isn't it?
In C something like that might do the work :
int compute(char* s)
{
int n = 0;
for (; *s; s++)
n += *s - '0';
return (n);
}
Yu could optimize by unrolling the loop for a certain amount of
iteration (for example 10) and only process the "jump" of the loop
every 10 character.
You could also use SIMD to process 4 integer at the same time.
--
Jérémie MARGUERIE
Étudiant à l'EPITA, ing2
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-code?hl=en.