https://www.acmicpc.net/problem/1699
import java.util.Scanner
import kotlin.math.*
fun main(args: Array<String>){
val sc: Scanner = Scanner(System.`in`)
var n = sc.nextInt()
var arr=Array<Int>(n+1,{0})
for(i in 0..n) arr[i]=i
for(i in 1..n){
for(j in 1..sqrt(i.toDouble()).toInt()){
if(arr[i]>arr[i-j*j]+1){
arr[i]=arr[i-j*j]+1
}
}
}
print(arr[n])
}