Question" CodeChef Lunch Time Div3 - N1Values
Please help, I’m not able to understand why this solution is failing. When it’s compiled and and tested - it gives the correct answer. But on submission, it shows wrong answer
#include <bits/stdc++.h>
using namespace std;
int main() {
int t; cin >> t;
while (t--) {
int n; cin >> n;
int sum = pow(2, n) - 2;
cout << "1 1";
int counter = 2;
for (int i = 1; i < n - 1; i++) {
cout << " " << counter;
sum -= counter;
counter++;
}
if (n != 1) cout << " " << sum;
if (t != 0) cout << "\n";
}
return 0;
}