Untitled
c_cpp
a month ago
603 B
3
Indexable
Never
#include <bits/stdc++.h> using namespace std; using ll = long long; const int MAX = 1e6 + 5; long double a[MAX]; int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif ios_base::sync_with_stdio(false); cin.tie(nullptr); long double s = 0, ms = 0; for (int i = 1; i <= MAX; i++) { ms += i; s += 1.0 / ms; a[i] = s; } int t; cin >> t; while (t--) { int n; cin >> n; cout << fixed << setprecision(8) << a[n] << endl; } }