https://www.acmicpc.net/problem/1699
import math n=int(input()) arr=[i for i in range(n+1)] for i in range(1,n+1): for j in range(1,int(math.sqrt(i))+1): if arr[i]>arr[i-j*j]+1: arr[i]=arr[i-j*j]+1 print(arr[n])