没事闲的

牛浩宇 · 发布于 2024-01-27 · 浏览 636 回复 0

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;

}

全部回复 共 0 条

还没有人回复。往下写第一条。

发表回复