Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solution added #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion Quest-2/Problem_statement.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,37 @@ For each test case, output on a new line, two space-separated integers, the mini

**Test case 1:** You had only 1 chocolate, so that must have been given to only 1 child.

**Test case 22:** You had 2 chocolates, so either you could have given both chocolates to 1 child only, or 1 chocolate each to 2 children.
**Test case 22:** You had 2 chocolates, so either you could have given both chocolates to 1 child only, or 1 chocolate each to 2 children.

#include <iostream>
using namespace std;
void
chocolatedis ()
{
int N;
cin >> N;
if (N >= 1 && N <= 1000)
{
if (N % 2 == 0)
{
cout << N / 2 << " " << N;
}
else
{
cout << (N / 2) + 1 << " " << N;
}
}
}

int main ()
{
int t;
cin >> t;
if (t >= 1 && t <= 1000)
{
for (int i = 1; i <= t; i++)
{
chocolatedis ();
}
}
}