#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
using namespace std;
typedef long long int ll;
int main()
{
istream in("input.txt", "r", stdin);
ofstream out("output.txt", "w", stdout);
int t;
in >> t;
while (t--)
{
ll n;
in >> n;
ll arr[n];
for (int i = 0; i < n; i++)
{
in >> arr[i];
}
sort(arr, arr + n);
double sum = 0;
for (int i = 0; i < n - 1; i++)
{
sum += arr[i];
}
double ans = (sum / (n - 1)) + arr[n - 1];
out << setprecision(9) << ans << endl;
}
return 0;
}
Note that I also changed my tasks.json file.
I changed my code according to what @john and @PepjinKramer said, but my inputs are not being read from the input.txt file and so nothing is shown in output.txt.
How do I solve this problem?