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...
c++ You have tons of toys that you want to divide into boxes. Each box can...
c++ You have tons of toys that you want to divide into boxes. Each box can store at most T toys and you got plenty of boxes. To distribute the toys, your plan is to divide the N toys in half, forming two smaller piles, then continue dividing each of the small piles in half until we get piles that can fit in the boxes. Find how many boxes you will need. This strategy may not give you the least...
Directions: Convert the following problem below to c++ equivalent code Problem 5: Take a random number...
Directions: Convert the following problem below to c++ equivalent code Problem 5: Take a random number from the user Multiply the number by 4 Add 1 to the number Multiply by the original number that the user input Subtract the original number away Take the square root of the number (you can use cmath’s sqrt function) Divide the number by 2 The result should be the original number Problem 8: For this problem I want you to draw out a...
Need this in C programming please with correct output of the code and also please attach...
Need this in C programming please with correct output of the code and also please attach the screenshot of it // In this problem, we try to find and fix a bug in the following code. // The following code is trying to calculate a sum that will converge to PI(3.141592....) // when the number of items goes to infinity. // This following code is based on the fact that // that sum of items 8/((4*i +1)*(4*i +3)) for i...
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:...