Codeforces 151A Soft drink Solution
Solve in C++:
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n, k, l, c, d, p, nl, np,t1,t2,kl,cd,r1,r2,t;
while(scanf("%d%d%d%d%d%d%d%d",&n, &k, &l, &c, &d, &p,&nl,&np)!=EOF)
{
kl=k*l;
t1=kl/nl;
cd=c*d;
t2=p/np;
r1=min(t1,cd);
r2=min(r1,t2);
printf("%d\n",r2/n);
}
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n, k, l, c, d, p, nl, np,t1,t2,kl,cd,r1,r2,t;
while(scanf("%d%d%d%d%d%d%d%d",&n, &k, &l, &c, &d, &p,&nl,&np)!=EOF)
{
kl=k*l;
t1=kl/nl;
cd=c*d;
t2=p/np;
r1=min(t1,cd);
r2=min(r1,t2);
printf("%d\n",r2/n);
}
return 0;
}
No comments