没事闲的

牛浩宇  •  9个月前


include

using namespace std;

int f(double c) {

int n = 2;
double cnt = 0;
while (cnt < c) {
	cnt += 1 / (double)n;
	n++;	
}
return n - 2;

}

int main() {

double c;
cin >> c;
while (c != 0) {
	int d = f(c);
	cout << d << endl;
	cin >> c;
}
return 0;

}


评论:

请先登录,才能进行评论