From 6884cdd41b4506ed775b3c50f9d525f2e71fee7d Mon Sep 17 00:00:00 2001 From: Bluemin <130892773+bluemincoder@users.noreply.github.com> Date: Sat, 13 Apr 2024 12:06:58 +0530 Subject: [PATCH] chore: day_19 --- easy/day_19/problem.txt | 20 ++++++++++++++++++++ easy/day_19/sample_test_cases.txt | 11 +++++++++++ easy/day_19/solution.cpp | 1 + 3 files changed, 32 insertions(+) create mode 100644 easy/day_19/problem.txt create mode 100644 easy/day_19/sample_test_cases.txt create mode 100644 easy/day_19/solution.cpp diff --git a/easy/day_19/problem.txt b/easy/day_19/problem.txt new file mode 100644 index 0000000..73c295f --- /dev/null +++ b/easy/day_19/problem.txt @@ -0,0 +1,20 @@ +You have a collection of n bags, each initially containing i candies in the i -th bag. Your aim is to distribute candies such that all bags contain an equal amount. + +To achieve this, you can: + +1. Choose a value m where 1 ≤ m ≤ 1000 . +2. Execute m operations. In each operation j , you'll select one bag and add j candies to all bags except the chosen one. + +Your task is to find a sequence of operations that leads to equal distribution of candies among all bags. It's guaranteed that such a sequence always exists given the constraints. + +Input: +- Each test consists of multiple test cases. +- The first line contains t (where 1 ≤ t ≤ 100 ) — the number of test cases. +- For each test case: a single integer n (where 2 ≤ n ≤ 100 ) representing the number of bags. + +Output: +- For each test case, print two lines: + 1. m (where 1 ≤ m ≤ 1000 ) — the number of operations. + 2. m positive integers a1, a2, . . ., am (where 1 ≤ ai ≤ n ) indicating the bag chosen in the i -th operation. + +You can output any valid sequence if there are multiple possible solutions. \ No newline at end of file diff --git a/easy/day_19/sample_test_cases.txt b/easy/day_19/sample_test_cases.txt new file mode 100644 index 0000000..84f7168 --- /dev/null +++ b/easy/day_19/sample_test_cases.txt @@ -0,0 +1,11 @@ +Example + +input +2 +2 +3 +output +1 +2 +5 +3 3 3 1 2 \ No newline at end of file diff --git a/easy/day_19/solution.cpp b/easy/day_19/solution.cpp new file mode 100644 index 0000000..8d3ad8d --- /dev/null +++ b/easy/day_19/solution.cpp @@ -0,0 +1 @@ +//write your code here \ No newline at end of file