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.
Constraints
1<= N <=10000000 (1e7)
0<= Quantity_of_ingredient <= LLONG_MAX
Output Format
Print the required output in a separate line.
sample test case
Input
4
2 5 6 3
20 40 90 50
output
8
Answers
Answer:
This can be done as follows :
/*Enter your code here. Read input from STDIN. Print your output to STDOUT*/
#include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int ing[n],lab[n],res[n];
int i;
for(i=0;i<n;i++)
{
cin>>ing[i];
}
for(i=0;i<n;i++)
{
cin>>lab[i];
}
for(i=0;i<n;i++)
{
res[i]=lab[i]/ing[i];
}
int min=res[0];
for(i=1;i<n;i++)
{
if(res[i]<min)
min=res[i];
}
cout<<min;
return 0;
}
Explanation:
The input consists of :
1. The first line of input consists of the number of ingredients, N
2. The second line of input consists of the N space-separated integers representing the quantity of each ingredient required to create a Powerpuff Girl.
3. The third line of input consists of the N space-separated integers representing the quantity of each ingredient present in the laboratory.
Explanation:
#include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int ing[n],lab[n],res[n];
int i;
for(i=0;i<n;i++)
{
cin>>ing[i];
}
for(i=0;i<n;i++)
{
cin>>lab[i];
}
for(i=0;i<n;i++)
{
res[i]=lab[i]/ing[i];
}
int min=res[0];
for(i=1;i<n;i++)
{
if(res[i]<min)
min=res[i];
}
cout<<min;
return 0;
}