# CDEC2202 - Editorial

Choclate Distribution - CDEC2202

Author: Rishi Singh
Tester: Sahil Soni
Editorialist: Rishi Singh

CAKEWALK.

None

# PROBLEM:

Arish loves chocolate very much, in his birthday Party Arish has to invite A number of friends and he has N number of chocolates.

At the end of the birthday, he has to take all chocolates in Infront of them and put them on a table. then he starts giving one chocolate to his A number of friends one by one, after everyone gets one chocolate, he again repeats the same process of giving one chocolate to each and goes on repeating that process until the number of chocolates left to him cannot be given to everyone because everyone should get an equal number of chocolates.

As the number of chocolates is fixed help Arish to find A number of friends to invite, such that the number of chocolates left to him after the process is maximum.

# EXPLANATION:

You just have to observe the process that you need to find A such that when N number of chocolates is divided by A, the remainder you get is maximum and if you observe further, to get the maximum remainder the number of friends A to be invited is always equal to ((N/2) + 1).

# SOLUTIONS:

Setter's Solution
``````#include <iostream>
using namespace std;

int main() {
int t;
cin>>t;
while(t--){
long long int n;
cin>> n;
cout<<(n/2)+1<<endl;
}
return 0;
}
``````