[challenge] light bulbs 06-21-2015, 12:55 PM
#1
Rules:
Your program may be written in any language of your choice
Your program may not take longer than 25 seconds to compute the answer
Problem:
You have a string of N light bulbs, all of which are turned off. Every second (S), light bulbs that are multiples of S toggle their state (off->on, on->off). After T seconds, what is the state of the light bulb in question (Q)?
Inputs:
N, T, Q
Outputs:
state(Q)
+1 rep and 50NSP if your program computes the correct result in under 5 seconds.
NOTE: a random number generator won't work, I will test each program a random number of times.
Limits:
10<N<4,294,967,296
100<T<1,000,000
Q is a 1-bit integer
EDIT: PLEASE include an example of how to compile and run if your language is not C/C++/Java. Sorry @Eclipse, lets see how it handles
Your program may be written in any language of your choice
Your program may not take longer than 25 seconds to compute the answer
Problem:
You have a string of N light bulbs, all of which are turned off. Every second (S), light bulbs that are multiples of S toggle their state (off->on, on->off). After T seconds, what is the state of the light bulb in question (Q)?
Inputs:
N, T, Q
Outputs:
state(Q)
+1 rep and 50NSP if your program computes the correct result in under 5 seconds.
NOTE: a random number generator won't work, I will test each program a random number of times.
Limits:
10<N<4,294,967,296
100<T<1,000,000
Q is a 1-bit integer
EDIT: PLEASE include an example of how to compile and run if your language is not C/C++/Java. Sorry @Eclipse, lets see how it handles

























![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)



