请楼主参考采纳
int fun(int t)
{
int i;
int current = 0;
for(i=1; total<=t; i++)
{
if (current + i > t)
break;
current += i;
}
return current;
}
int fun(int t)
{
int i = 0;
int j = 1;
int k = 1;
if (t<=0) return -1;
else if (t==1) return 0;
else
{
while (k < t)
{
k = i + j;
i = j;
j = k;
}
return i;
}
}
int fun(int t)
{
int i;
int current = 0;
for(i=1; total<=t; i++)
{
if (current + i > t)
break;
current += i;
}
return current;
}