My issue
In this ques I have added one chocolate to each jar first to satisfy the at least one in each jar condition and decreased total chocolates by 3. Then the remaining are distributed on basis of them being odd or even, if odd all of them are added to a single and if even both are divided equally and added to two jars. I think this approach satisfies all conditions but still getting wrong answer.
My code
#include <iostream>
using namespace std;
void solve()
{
int n ;
cin>>n;
n=n-3;
if(n%2 == 0)
{
cout<<1<<" "<<n/2<<" "<<n/2;
}
else
{
cout<<1<<" "<<n+1<<" "<<1;
}
cout<<endl;
}
int main() {
// your code goes here
int t ;
cin>>t ;
while(t--)
{
solve();
}
return 0;
}
Problem Link: CHOCOCHEF Problem - CodeChef