Initiate Luogu

This commit is contained in:
e2hang
2025-08-13 21:38:49 +08:00
parent ab606e0cbd
commit 8bfe9f31f3
22 changed files with 735 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
#include <iostream>
using namespace std;
int main()
{
double sum; // Use double for sum to handle fractions
int n, k;
cin >> k;
n = 1;
sum = 0.0;
while (sum <= k)
{
sum = sum + 1.0 / n; // Use 1.0 to ensure floating-point division
n++;
}
cout << n - 1 << endl; // n is incremented one extra time in the loop
return 0;
}