Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Foundation
- var currentLampState = [Bool](count: 100, repeatedValue: false)
- var switchingLamp : [Bool] = []
- for i in 1 ... 100 {
- for j in 1 ... 100 {
- let switchState = (j % i) == 0
- switchingLamp.append(switchState)
- }
- let newState = zip(currentLampState, switchingLamp).map{$0 != $1}
- currentLampState = newState
- switchingLamp.removeAll()
- }
- print("new state : \(currentLampState) EoN \n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement