1000 students and 1000 Lockers problem question. C++ loops
Автор: CodeMadeEasy
Загружено: 2023-03-03
Просмотров: 2589
Описание:
A high school has 1000 students and 1000 lockers, one locker for each
student. On the first day of school, the principal plays the following game:
She asks the first student to go and open all the lockers. She then asks the
second student to go and close all the even-numbered lockers. The third
student is asked to check every third locker. If it is open, the student closes
it; if it is closed, the student opens it. The fourth student is asked to check
every fourth locker. If it is open, the student closes it; if it is closed, the
student opens it. The remaining students continue this game. In general, the
nth student checks every nth locker. If the locker is open, the student closes
it; if it is closed, the student opens it. After all the students have taken their
turn, some of the lockers are open and some are closed.
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: