My issue
can someone explain me why a case like 2,2,2,2,0 does not work, it satisfies both the conditions as well as all the numbers are integers as well and it can easily be proved that 2*(n-1)+0 will work for every odd number.
My code
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
#define int long long
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin>>t;
while(t--){
int n;
cin>>n;
if(n==1){
cout<<1<<endl;
continue;
}
if(n==3){
cout<<5<<" "<<6<<" "<<3<<endl;
continue;
}
int a[n];
for(int i=0; i<n-1; i++){
a[i] = 2;
}
a[n-1] = 0;
for(int i=0; i<n; i++){
cout<<a[i]<<" ";
}
cout<<endl;
}
}
Problem Link: Prefix Suffix Inequality Practice Coding Problem