Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write to java Arrange sweet desserts ( SweetStack ) At the party welcoming new friends to the Department of Computer Science A set of beautiful,
Write to java
Arrange sweet desserts SweetStack
At the party welcoming new friends to the Department of Computer Science A set of beautiful, round sweet treats was ordered at the S set. One set had all Ki sweet treats i S The students were tasked with arranging these sweet treats into layers. top floor It's called layer and the bottom layer is called layer Ni Each layer must have the same number of snacks as the number for that layer. For example, If there are desserts in total, the desserts will be arranged exactly levels high, as shown in Figure
Figure : Arrangement of dessert layers in Set which has a total of K pieces, according to the characteristics specified in the problem, resulting in a total of N layers exactly.
Have students write a program to find out. From the total number of desserts provided in each set How many layers can the dessert be arranged? And how many unused snacks will be left?
input data
The input data has S line as follows.
Line one Consists of one integer. Specify the number of dessert sets. S is set to S
Lines through S each contain one integer. Specify the number of sweets within the set Ki
note
Specify that every input always has the correct format, bounds, and set of possible values. Students do not need to validate their input.
Export data
The exported data has S lines.
Each line shows the result of arranging desserts in set i into two integers. The first number indicates the number of the bottom layer Ni and the last number indicates the number of snacks left from sorting. Separate each number with one space.
Example
input data
Export data
Example
input data
Export data
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started