Answered step by step
Verified Expert Solution
Link Copied!

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 (1<= i <= S). The students were tasked with arranging these sweet treats into layers. top floor It's called layer 1 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 6 desserts in total, the desserts will be arranged exactly 3 levels high, as shown in Figure 1.
Figure 1: Arrangement of dessert layers in Set 1, which has a total of K1=6 pieces, according to the characteristics specified in the problem, resulting in a total of N1=3 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 +1 line as follows.
Line one Consists of one integer. Specify the number of dessert sets. S is set to 1<= S <=20.
Lines 2 through S +1 each contain one integer. Specify the number of sweets within the set (1<= Ki <=999)
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 1
input data
1
6
Export data
30
Example 2
input data
3
5
6
9
Export data
22
30
33

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The World Wide Web And Databases International Workshop Webdb 98 Valencia Spain March 27 28 1998 Selected Papers Lncs 1590

Authors: Paolo Atzeni ,Alberto Mendelzon ,Giansalvatore Mecca

1st Edition

3540658904, 978-3540658900

More Books

Students also viewed these Databases questions

Question

3. Describe the communicative power of group affiliations

Answered: 1 week ago