Concurso Programacion
https://contest.tuenti.net/?m=Contest&func=index
Tuenti Programming Contest
Contest Stats Tools Sample Help
Logout
Challenge 9: Christmas lights
It's alwaysChristmas in Christmasville, and there are many laws about the christmas decoration that can be used there. Mr. Grinch Claus, mayor of Christmasville has defined that the christmas lights have toblink in a special way, where: In a set of christmas lights, all light bulbs are sequentially connected by a power cable, where each one has a numerated, in sequence, starting from 0 No neighbor lightscan be turned on at the same time When pluged to the power, all lamps must be off, and after one second, only the first lamp (lamp #0) turns on After that, at every second the light(s) that were on, gooff and their neighbors turn on, like this: Instant 0 - All lights are off Instant 1 - Light #0 turns on Instant 2 - Light #0 turns off and light #1 turns on Instant 3 - Light #1 turns off and lights#0 and #2 turn on Instant 4 - Lights #0 and #2 turn off and lights #1 and #3 turn on Instant 5 - Lights #1 and #3 turn off and lights #0, #2 and #4 turn on ... To make sure every factory is followingthese restrictions, Mr. Grinch Claus asked you to write a software to validate this behavior, and given the number of lights in the set and the instant of time, your software must tell which lampsshould be ON at that moment.
Input
N - number of test cases, the number of inputs you need to validate For every N test case, the input has: l - the number of lights in the set t - the time, inseconds from the moment the set was turn on, that you want to verify
Output
For each N test cases, one line with the list of lights that are turned on (in order) or All lights are off :( if there's nolight turned on
Limits
1 ≤ N ≤ 100 1 ≤ l ≤ 64 1 ≤ t ≤ 109
Example
1 de 3
17/06/11 22:03
Tuenti Programming Contest
https://contest.tuenti.net/?m=Contest&func=index
Sample...
Regístrate para leer el documento completo.