151A - Soft Drinking - CodeForces Solution


implementation math *800

Please click on ads to support us..

Python Code:

n, k, l, c, d, p, nl, np = map(int, input().split())
total_drink_in_ml = k*l
total_lime_slices = c*d
total_salt_in_gram = p
one_salt = np
one_drink = nl
one_slice = 1
total_list = [total_drink_in_ml, total_lime_slices, total_salt_in_gram]
one_list = [one_drink, one_slice, one_salt]
each_person_list = [i//n for i in total_list]
ans_list = []
for i in range(len(one_list)):
    ans_list.append(each_person_list[i]//one_list[i])
print(min(ans_list))

C++ Code:

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,l,c,d,p,nl,np;
    cin>>n>>k>>l>>c>>d>>p>>nl>>np;
    int x,y,z;
    x=(k*l)/nl;
    y=c*d;
    z=p/np;
    int mx=min(x,y);
    mx=min(mx,z);
    cout<<mx/n<<endl;

}


Comments

Submit
0 Comments
More Questions

53A - Autocomplete
1729G - Cut Substrings
805B - 3-palindrome
805C - Find Amir
676C - Vasya and String
1042B - Vitamins
1729F - Kirei and the Linear Function
25D - Roads not only in Berland
1694A - Creep
659F - Polycarp and Hay
1040A - Palindrome Dance
372A - Counting Kangaroos is Fun
1396B - Stoned Game
16A - Flag
1056A - Determine Line
670B - Game of Robots
1418C - Mortal Kombat Tower
1382B - Sequential Nim
1272C - Yet Another Broken Keyboard
808A - Lucky Year
1245A - Good ol' Numbers Coloring
58B - Coins
1041C - Coffee Break
507A - Amr and Music
1041D - Glider
1486A - Shifting Stacks
1389B - Array Walk
71B - Progress Bar
701A - Cards
545A - Toy Cars