From d9a9ead4cc773ab923df518e6161719704789e88 Mon Sep 17 00:00:00 2001 From: Mustafa11300 Date: Wed, 1 May 2024 22:40:15 +0530 Subject: [PATCH] solution added --- Quest-2/Problem_statement.md | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/Quest-2/Problem_statement.md b/Quest-2/Problem_statement.md index d34d70c..2d1f4e1 100644 --- a/Quest-2/Problem_statement.md +++ b/Quest-2/Problem_statement.md @@ -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. \ No newline at end of file +**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 +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 (); + } + } +}