1.答案
#include<stdio.h>
#include<string.h>
#include<math.h>
double count(double x, int n)
{
int i, j;
double y = x, m = n, sum;
i = n;
for (j = 2; j <= i; j++)
{
y = y * x;
m = m * (n - j + 1);
}
sum = y / m;
return sum;
}
int main()
{
double i,j,x, n, sum1 = 1, sum2 = sum1, a;
int num;
scanf("%lf %lf", &i, &j);
x = i, n = j;
for (num = 1; ; num++)
{
a = count(x, num);
sum2 = sum1 + a;
if (fabs(sum1 - sum2) <= j || x == 0)
{
break;
}
else
{
sum1 = sum2;
}
}
printf("%d", num);
}