304 North Cardinal St.
Dorchester Center, MA 02124

# Maximum Light Up CodeChef Solution

## Maximum Light Up CodeChef Solution in C++17

``````#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fast                          \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);                    \
cout.tie(NULL);
#define fileio                         \
freopen("input.txt", "r", stdin);  \
freopen("output.txt", "w", stdout);
#define pb push_back
#define vll vector<ll>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define vpll vector<pair<ll, ll>>
#define stll set ll
#define msgll multiset<ll, greater<>>
#define msll multiset<ll>
#define mpll map<ll, ll>

void infinity()
{
ll p,a,b,c,x,y;
cin>>p>>a>>b>>c>>x>>y;
if(b+a*x<c+a*y)
{
cout<<p/(b+a*x);
}
else
{
cout<<p/(c+a*y);
}
cout<<"\n";
}

int main()
{
fast
ll t;
cin >> t;
while (t--)
{
infinity();
}
return 0;
}``````

## Maximum Light Up CodeChef Solution in C++14

``````#include <bits/stdc++.h>
using namespace std;
#define f(a,b,n) for(int a=b; a<n; a++)
#define ll long long
#define lli long long int

void solve(){
long p,a,b,c,x,y;
cin>>p>>a>>b>>c>>x>>y;
ll sum = min((b+x*a), (c+y*a));
cout<<(int)(p/sum)<<endl;
}

int main(){
int cases;
cin>>cases;
while(cases--){
solve();
}
return 0;
}``````

## Maximum Light Up CodeChef Solution in PYTH 3

``````# cook your dish here
for _ in range(int(input())):
p,a,b,c,x,y= map(int,input().split())
A = a*x + b
C = a*y + c
m = min(A,C)
print(p//m)``````

## Maximum Light Up CodeChef Solution in C

``````#include <stdio.h>

long long int min(long long int a,long long int b){
if(a < b)
return a;
return b;
}

int main() {
int tt;
scanf("%d",&tt);
while(tt--){
long long int p,a,b,c,x,y;
scanf("%lld %lld %lld %lld %lld %lld",&p,&a,&b,&c,&x,&y);
b = b+(a*x);
c= c+ (a*y);
b= min(b,c);
printf("%d\n",p/b);
}
return 0;
}``````

## Maximum Light Up CodeChef Solution in JAVA

``````/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
BufferedWriter writer=new BufferedWriter(new OutputStreamWriter(System.out));
while(tt-->0){
long p=input[0], a=input[1], b=input[2], c=input[3], x=input[4], y=input[5];
writer.write(Math.max(p/(x*a+b), p/(y*a+c))+"\n");
}
writer.flush();
}

private static int[] parseInt(String str) {
String[] parts=str.split("\\s+");
int[] ans=new int[parts.length];
for(int i=0;i<ans.length;i++){
ans[i]=Integer.parseInt(parts[i]);
}
return ans;
}

private static long[] parseLong(String str) {
String[] parts=str.split("\\s+");
long[] ans=new long[parts.length];
for(int i=0;i<ans.length;i++){
ans[i]=Long.parseLong(parts[i]);
}
return ans;
}
}``````

## Maximum Light Up CodeChef Solution in PYPY 3

``````t=int(input())
for j in range(t):
p,a,b,c,x,y=map(int,input().split())
r=b+x*a
s=c+y*a
v=min(r,s)
print(p//v)``````

## Maximum Light Up CodeChef Solution in PYTH

``````# cook your code here
t=int(input())
for i in range(t):
p,a,b,c,x,y=raw_input().split(" ")
p=int(p)
a=int(a)
b=int(b)
c=int(c)
x=int(x)
y=int(y)
v=x*a+b
w=y*a+c
if(min(v,w)<p):
print(p/min(v,w))
else:
print("0")``````

## Maximum Light Up CodeChef Solution in C#

``````using System;

public class Test
{
public static void Main()
{

while (t-- > 0)
{
long p = long.Parse(s[0]);
long a = long.Parse(s[1]);
long b = long.Parse(s[2]);
long c = long.Parse(s[3]);
long x = long.Parse(s[4]);
long y = long.Parse(s[5]);

long result = p / Math.Min(b + (x * a), c + (y * a));
Console.WriteLine(result);
}
}
}``````

## Maximum Light Up CodeChef Solution in GO

``````package main

import (
"bufio"
"bytes"
"fmt"
"os"
)

func main() {

var buf bytes.Buffer

for tc > 0 {
tc--
res := solve(line[0], line[1], line[2], line[3], line[4], line[5])
buf.WriteString(fmt.Sprintf("%d\n", res))
}

fmt.Print(buf.String())
}

func readInt(bytes []byte, from int, val *int) int {
i := from
sign := 1
if bytes[i] == '-' {
sign = -1
i++
}
tmp := 0
for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
tmp = tmp*10 + int(bytes[i]-'0')
i++
}
*val = tmp * sign
return i
}

return
}

a, b = res[0], res[1]
return
}

a, b, c = res[0], res[1], res[2]
return
}

res := make([]int, n)
x := 0
for i := 0; i < n; i++ {
for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
x++
}
}
return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
i := from

var tmp uint64
for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
tmp = tmp*10 + uint64(bytes[i]-'0')
i++
}
*val = tmp

return i
}

func solve(P, a, b, c, x, y int) int64 {
n := min(int64(b)+int64(x)*int64(a), int64(c)+int64(y)*int64(a))
return int64(P) / n
}

func min(a, b int64) int64 {
if a <= b {
return a
}
return b
}``````
##### Maximum Light Up CodeChef Solution Review:

In our experience, we suggest you solve this Maximum Light Up CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

If you are stuck anywhere between any coding problem, just visit Queslers to get the Maximum Light Up CodeChef Solution.

Find on CodeChef

##### Conclusion:

I hope this Maximum Light Up CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Programming Language in a business context; there are no prerequisites.

Keep Learning!