Why is my solution wrong?
#include<stdio.h>
long func(long a,long b,long c);
long pow(long x,long y);
long result=1;
long n;
long k;
int count=0;
int main(){
scanf("%ld",&n);
k=n;
for(;k>0;){
k-=pow((long)sqrt(k),2);;
result=1;
count++;
};
func(n,0,(long)sqrt(n));
printf("%d",count);
for(;;);
};
long pow(long x,long y){
if (y!=0) return x*pow(x,y-1);
return 1;
};
long func(long a,long b,long c){
int i;
if (b>=count || a<0) return 0;
if (b<count && a==0){
count=b;
printf("%ld %ld %ld\n",a,b,c);
};
for(i=c;i>0;i--) func(a-pow(i,2),b+1,i);
};