请问各位大佬超时了怎么改
查看原帖
请问各位大佬超时了怎么改
1504215
zlh202483023楼主2024/11/21 16:09
#include<iostream>
using namespace std;
int main() {
	int k,n;
	double sum;
	n = 1;
	sum = 0;
	cin >> k;
	while (k > sum) {
		sum = sum +double( 1 / n);
		n++;
	}
	cout << n;
	return 0;
}
2024/11/21 16:09
加载中...