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...
# Problem Description Given a directed graph G = (V,E) with edge length l(e) > 0...
# Problem Description Given a directed graph G = (V,E) with edge length l(e) > 0 for any e in E, and a source vertex s. Use Dijkstra’s algorithm to calculate distance(s,v) for all of the vertices v in V. (You can implement your own priority queue or use the build-in function for C++/Python) # Input The graph has `n` vertices and `m` edges. There are m + 1 lines, the first line gives three numbers `n`,`m` and `s`(1 <=...
Problem: Our Armstrong number Please write code for C language So far we have worked on...
Problem: Our Armstrong number Please write code for C language So far we have worked on obtaining individual digits from 4 digits or 5 digit numbers. Then added them to find the sum of digits in various examples and assignments. However, the process of extracting individual digits is actually can be solved using a loop as you were doing a repetitive task by using mod operation and division operation. Now, we know how loops work and we can remove the...
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:...
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...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT