Submission details
Task:Arvonta
Sender:actually
Submission time:2025-09-06 21:23:17 +0300
Language:C++ (C++17)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED37
#2ACCEPTED63
Test results
testverdicttimegroup
#1ACCEPTED0.00 s1, 2details
#2ACCEPTED0.01 s2details

Code

#include <iostream>

using namespace std;

typedef long long ll;
typedef long double ld;

double power(double x, int e) {
    double ans = 1;
    for (int i = 0; i < e; i++) {
        ans = x*ans;
    }
    return ans;
}

void testCase() {
    int n; cin >> n;
    if (n == 1) {
        cout << "1.0\n";
    } else {
        double x = (n - 1)/(1.0*n);
        double ans = 1 - power(x, n);
        cout << ans << "\n";
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin >> t;
    for (int i = 0; i < t; i++) {
        testCase();
    }
}

Test details

Test 1

Group: 1, 2

Verdict: ACCEPTED

input
10
1
2
3
4
...

correct output
1.0
0.75
0.7037037037
0.68359375
0.67232
...

user output
1.0
0.75
0.703704
0.683594
0.67232
...

Test 2

Group: 2

Verdict: ACCEPTED

input
1000
1
2
3
4
...

correct output
1.0
0.75
0.7037037037
0.68359375
0.67232
...

user output
1.0
0.75
0.703704
0.683594
0.67232
...
Truncated