+ 2

CHALLENGE

The numbers numerated from 1 to N will cross a hall with doors also mumerated from 1 to N. Each number will change the state of the doors numerated with its multiples, closing the ones that were opened and opening the ones that were closed (initially they are all closed). For instance, when the number one crosses the hall, it opens all of the doors; when number two crosses it, the doors with even numbers will close. The input will be the integer N (1<=N<=25*10^6) and the output the opened doors in the end.

26th Sep 2017, 4:07 PM
Arthur Queiroz Moura
Arthur Queiroz Moura - avatar
3 Antworten
26th Sep 2017, 4:28 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 1
it the input is 3 for instance, the only opened door at the end of the proccess will be "1"; however if the input is 5; the output will be "1 4", bc 1 and 4 will be opened at the final of the proccess. I don't want it to show time limot exceded when the input is 25*10^6
26th Sep 2017, 4:09 PM
Arthur Queiroz Moura
Arthur Queiroz Moura - avatar
+ 1
my practice on python https://code.sololearn.com/cO15Dy8VcO34/#py plus I'll get until where I got time limit exceded ☺ until 3200 doors on mobile
27th Sep 2017, 3:12 AM
ysraelcon
ysraelcon - avatar