https://www.acmicpc.net/problem/1699
#include<stdio.h>
int main() {
int n;
scanf("%d",&n);
int arr[100001]={};
for(int i=0;i<=n;i++) arr[i]=i;
for(int i=1;i<=n;i++){
for(int j=1;j*j<=i;j++){
if(arr[i]>arr[i-j*j]+1){
arr[i]=arr[i-j*j]+1;
}
}
}
printf("%d",arr[n]);
}