You are viewing a single comment's thread. Return to all comments →
Beautiful days using beautiful Swift.....
import Foundation let input: [Int] = readLine()!.componentsSeparatedByString(" ").map { Int($0) ?? 0 } let i: Int = input[0] let j: Int = input[1] let k: Int = input[2] var beautifulDays: Int = 0 for integer in i...j { var int2reverse: Int = integer var reversedNum: Int = 0 while int2reverse != 0 { reversedNum = reversedNum * 10 + int2reverse % 10 int2reverse = int2reverse / 10 } let absDiff: Int = max(integer, reversedNum) - min(integer, reversedNum) if absDiff % k == 0 { beautifulDays += 1 } } print(beautifulDays)
Seems like cookies are disabled on this browser, please enable them to open this website
Beautiful Days at the Movies
You are viewing a single comment's thread. Return to all comments →
Beautiful days using beautiful Swift.....