Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sum : Int64 = 0
- part1 : Int64 = 0
- part2 : Int64 = 0
- done1 = false
- done2 = false
- spawn do
- (0..500000000).each do |num|
- part1 += num
- end
- done1 = true
- end
- spawn do
- (500000001..1000000000).each do |num|
- part2 += num
- end
- done2 = true
- end
- while !done1 && !done2
- sleep 1.second
- end
- sum = part1 + part2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement