Techgig code gladiators 2020 solutions - I | Python Practice

                                   Test-I Solution

Problem statement:

The Powerpuff Girls 

Professor Utonium is restless because of the increasing crime in the world. The number of villains and their activities has increased to a great extent. The current trio of Powerpuff Girls is not well to fight the evils of the whole world. Professor has decided to create the maximum number of Powerpuff Girls with the ingredients he has.

There are N ingredients required in a certain quantity to create a Powerpuff Girl. Professor has all the N ingredients in his laboratory and knows the quantity of each available ingredient. He also knows the quantity of a particular ingredient required to create a Powerpuff Girl. The professor is busy with the preparations and wants to start asap.

The villains, on the other hand, want to destroy the laboratory and stop Professor Utonium from creating more Powerpuff girls. Mojo Jojo is coming prepared with ammunition and Him is leading other villains like Princess, Amoeba Boys, Sedusa, Gangreen Gang, etc.

Professor does not have much time as villains will reach the laboratory soon. He is starting the process but does not know the number of Powerpuff Girls which will be created. He needs your help in determining the maximum number of Powerpuff Girls which will be created with the current quantity of ingredients.


Professor Utonium requires 3 ingredients to make Powerpuff Girls. The 3 ingredients are present in the laboratory in the given quantity:

To make a Powerpuff Girl, Professor Utonium requires:

  1. 3 units of Ingredient A

  2. 6 units of Ingredient B

  3. 10 units of Ingredient C

The maximum number of Powerpuff Girls that can be created is 3 as, after 3, Professor will run out of Ingredient C.

Techgig , code gladiator,

Can you determine the maximum number?

How to solve this problem

To solve this problem we want to analyze or understand the problem statements.

So, of all, we need to understand the question and solve this problem.
So, our first need to understand the question.
Get the input n the python programming.
And then try to solve the problem in a python programming language by apply logic.
Then print the output using the giving method.

Explanation of the problem statements

So, our question said that we have given the 3 chemicals with different quantity and we want to make a substance using these three chemicals and with different quantities of the chemicals. A first chemical named A and a second chemical named B and a third chemical named B. 
So, to make a new substance we required 3 units from the A chemical and 6 unit from the B chemical, and 10 units from the C chemical and all three chemical A, B, C have a total of 10 unit quantity.

So, we have to find, how much the total number of the new substance was formed by this. 

Input Format

The first line of input consists of the number of ingredients, N

The second line of input consists of the N space-separated integers representing the quantity of each ingredient required to create a Powerpuff Girl.

The third line of input consists of the N space-separated integers representing the quantity of each ingredient present in the laboratory.


1<= N <=10000000 (1e7)

0<= Quantity_of_ingredient <= MAX

Output Format

Print the required output in a separate line.

Steps to solve the problem in python

First, we will take the input from the user using the giving input method
so, first, we will take the input of the number of the chemical used to make the new substance. And then the quantity required to make a new substance and then how much quantity is available in the laboratory.

Then we will apply the for loop to divide each term and then store the value in the list and lastly print the output.


In Python3 and JAVA8

In Python3:

def main():
	lists=[ ]
	for i in range(num):
#Made by Ankur Patel.


BufferedReader reader = new BufferedReader(new InputStreamReader(;
int ingredients = Integer.valueOf(reader.readLine());
String[] requireIngredients = reader.readLine().split(" ");
String[] availableIngredients = reader.readLine().split(" ");
Integer[] output = new Integer[ingredients];
for (int i = 0; i < ingredients; i++) {
    output[i] = Integer.valueOf(availableIngredients[i]) / Integer.valueOf(requireIngredients[i]);
//Made by Ankur Patel
2 5 6 3 
20 40 90 50 

If you have a better solution or query, please share in comment or Email.

Next Post Previous Post
No Comment
Add Comment
comment url