12345678910111213141516171819202122let input = Int(readLine()!)!var array = [Int]()let maxFive = input / 5for countFive in 0...maxFive{ var value = input value -= (countFive * 5) let countThree = value / 3 value -= (countThree * 3) if(value != 0){ array.append(-1) } else{ array.append(countThree + countFive) }}array = array.filter { $0 != -1 }if(array.count == 0){ print("-1")}else{ print(array.m..
1234567891011121314151617181920212223242526func solve(start: Int, end: Int, count: inout Int) -> Int{ if(start == 0){ return count + end } else{ for i in 1...end{ count = solve(start: start - 1, end: i, count: &count) } return count }} let input = Int(readLine()!)!var k = [Int]()var n = [Int]()for _ in 1...input{ k.append(Int(readLine()!)!) n.append(Int(readLine()!)!)}for i in 0..
123456789101112131415161718192021let input = Int(readLine()!)!var temp = 0var first = 1var second = 1var count = 2if(input == 1){ print("1")}else if(input == 2){ print("1")}else{ while(input != count){ temp = first + second first = second second = temp count += 1 } print(temp) }cs
1234567891011121314let input = Int(readLine()!)!for _ in 1...input{ let sentence = readLine()?.split(separator: " ") let repeatCount = Int((sentence?.first!.description)!)! let string = (sentence?.last!.description)! var result = "" for i in 0..
123456789101112131415161718192021222324252627282930313233343536373839404142434445import Foundation func isPrime(value: Int) -> Bool{ if(value == 1){ return false } var count = 0 for i in 1...Int(sqrt(Double(value))){ if(value % i == 0){ count += 1 } } if(count == 1){ return true } else{ return false }}var input = [Int]()for _ in 0...1{ input.append(Int(readLine()!)!)}let m = input.first!let n = ..
1234567891011121314151617181920212223242526272829303132333435363738394041import Foundation var number = 1var array: [Int] = [0,0,0,0,0,0,0,0,0,0]for _ in 0...2{ if let value = readLine(){ number *= Int(value.trimmingCharacters(in: .whitespaces))! }}//print(number)let numberToString = String(number)for i in 0..