Question

C Programming Language Problem Title : Container Today is Jojo’s birthday. To prepare the birthday party,...

C Programming Language

Problem Title : Container

Today is Jojo’s birthday. To prepare the birthday party, Jojo asks Bibi to bring N cubes with edge length S for the game on his birthday party. The only idea that came up to Bibi’s mind is to bring the cubes with rectangular box containers. Then Bibi went to a store. The only container available in the store is a container with size A × B × C. Bibi is a thrifty person. Therefore, she wants to buy the minimum number of containers so that she can load all the cubes. As a good friend of Bibi, help her to calculate the minimum numbers of containers she must buy.

Format Input

In this case, the input of this problem starts with a line contains 5 integers N S A B C consecutively as the number of cubes, the edge length of cube, the length of the container, the width of the container, and the height of the container.

Format Output

The output of this problem consists of an integer describing the minimum number of containers Bibi must buy.

Constraints

  • 1 ≤ N ≤ 109
  • 1 ≤ A, B, C ≤ 1000
  • 1 ≤ SMIN(A, B, C)

Sample Input & Output (1) (standard input & output)

24 4 8 8 8

3

Sample Input & Output (2) (standard input & output)

27 3 8 4 10

5

Homework Answers

Answer #1

Note: If you have any confusion feel free to comment ..i will try to help you out ...but do not give negative rating to the question as it affects my answering rights....

Note:I have only used basic unitry maths here so dont think too much of wht has been done..if you dont get something comment below...but dont panic...

#include <stdio.h>
#include <math.h>
int main() {
    int N,S,A,B,C;
    printf("Enter values of N, S, A, B, and C: ");
    scanf("%d %d %d %d %d",&N,&S,&A,&B,&C);
    A=A/S;//the variable A stores the total length which is completely
    //occupied by S
    B=B/S;//total width completely occupied by S
    C=C/S;//total height completely occupied by S 
   
    int no=ceil((double)N/(A*B*C));//we do a round up because the output required is the count of containers 
    //for eg 4.78 means that it has actually 5 containers requirement
    //
    printf("The total no of rectangular containers required are: %d",no);
    return 0;
}

Output:->

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
C Programming Language Problem Title : Promotion Jojo is at the supermarket buying monthly groceries. As...
C Programming Language Problem Title : Promotion Jojo is at the supermarket buying monthly groceries. As he was passing alley by alley, a certain banner caught his interest. Buy K cans of cola and get 1 free while one can of cola costs D dollars. As an avid cola fan, Jojo wouldn’t want to miss this amazing opportunity. Jojo is bad at math and so he asks you to count the price that he needs to pay if he plans...
C Programming Language Problem Title : Magical Cave Lili, a great magician, has a mission to...
C Programming Language Problem Title : Magical Cave Lili, a great magician, has a mission to enter a cave to get treasure inside. The cave only has 1 path without branches. But the cave is not safe because there are some traps inside that can reduce Lili’s life points. But in addition to traps, the cave also has potions that can increase Lili’s life points. Before entering the cave, Lili casts magic that can reveal all the traps and potions...
For this assignment you need to write a parallel program in C++ using OpenMP for vector...
For this assignment you need to write a parallel program in C++ using OpenMP for vector addition. Assume A, B, C are three vectors of equal length. The program will add the corresponding elements of vectors A and B and will store the sum in the corresponding elements in vector C (in other words C[i] = A[i] + B[i]). Every thread should execute approximately equal number of loop iterations. The only OpenMP directive you are allowed to use is: #pragma...
For this assignment, you need to write a parallel program in C++ using OpenMP for vector...
For this assignment, you need to write a parallel program in C++ using OpenMP for vector addition. Assume A, B, C are three vectors of equal length. The program will add the corresponding elements of vectors A and B and will store the sum in the corresponding elements in vector C (in other words C[i] = A[i] + B[i]). Every thread should execute an approximately equal number of loop iterations. The only OpenMP directive you are allowed to use is:...
Written in MASM Assembly Problem Definition: Write a program to calculate Fibonacci numbers. • Display the...
Written in MASM Assembly Problem Definition: Write a program to calculate Fibonacci numbers. • Display the program title and programmer’s name. Then get the user’s name, and greet the user. • Prompt the user to enter the number of Fibonacci terms to be displayed. Advise the user to enter an integer in the range [1 .. 46]. • Get and validate the user input (n). • Calculate and display all of the Fibonacci numbers up to and including the nth...
C ASE PRO B L E M 2: M c NEIL’S A UTO M ALL Harriet...
C ASE PRO B L E M 2: M c NEIL’S A UTO M ALL Harriet McNeil, proprietor of McNeil’s Auto Mall, believes that it is good business for her atuomobile dealership to have more customers on the lot than can be served, as she believes this creates an impression that demand for the automobiles on her lot is high. Copyright 2020 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due...
You will write a program that loops until the user selects 0 to exit. In the...
You will write a program that loops until the user selects 0 to exit. In the loop the user interactively selects a menu choice to compress or decompress a file. There are three menu options: Option 0: allows the user to exit the program. Option 1: allows the user to compress the specified input file and store the result in an output file. Option 2: allows the user to decompress the specified input file and store the result in an...
Curve-Fit Function USING MATLAB Using the top-down design approach, develop a MATLAB function A8P2RAlastname.m that reads...
Curve-Fit Function USING MATLAB Using the top-down design approach, develop a MATLAB function A8P2RAlastname.m that reads data from a file and performs regression analysis using polyfit and polyval. The function shall have the following features: The input arguments shall include the file name (string), a vector of integers for the degrees of polynomial fits to be determined, and an optional plot type specifier (‘m’ for multiple plots, ‘s’ for a single plot - default). The data files will be text...
Strings The example program below, with a few notes following, shows how strings work in C++....
Strings The example program below, with a few notes following, shows how strings work in C++. Example 1: #include <iostream> using namespace std; int main() { string s="eggplant"; string t="okra"; cout<<s[2]<<endl; cout<< s.length()<<endl; ​//prints 8 cout<<s.substr(1,4)<<endl; ​//prints ggpl...kind of like a slice, but the second num is the length of the piece cout<<s+t<<endl; //concatenates: prints eggplantokra cout<<s+"a"<<endl; cout<<s.append("a")<<endl; ​//prints eggplanta: see Note 1 below //cout<<s.append(t[1])<<endl; ​//an error; see Note 1 cout<<s.append(t.substr(1,1))<<endl; ​//prints eggplantak; see Note 1 cout<<s.find("gg")<<endl; if (s.find("gg")!=-1) cout<<"found...
MATHEMATICS 1. The measure of location which is the most likely to be influenced by extreme...
MATHEMATICS 1. The measure of location which is the most likely to be influenced by extreme values in the data set is the a. range b. median c. mode d. mean 2. If two events are independent, then a. they must be mutually exclusive b. the sum of their probabilities must be equal to one c. their intersection must be zero d. None of these alternatives is correct. any value between 0 to 1 3. Two events, A and B,...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT