Maximum Production (EITA) Solution — Codechef July Long Challenge

Input

  • The first line contains an integer T, the number of test cases. Then the test cases follow.
  • Each test case contains a single line of input, four integers dd, x, y, z.

Output

Constraints

  • 1≤T≤5⋅10³
  • 1≤d<7
  • 1≤z<x<y≤18

Subtasks

Sample Input

3
1 2 3 1
6 2 3 1
1 2 8 1

Sample Output

14
19
14

Explanation

/* 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
{
// your code goes here
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();

while(t-- > 0){
long d = sc.nextLong();
long x = sc.nextLong();
long y = sc.nextLong();
long z = sc.nextLong();

System.out.println(Math.max(x*7,(y*d+(z*(7-d)))));

}
}
}

--

--

--

Software Developer ,currently pursuing B.Tech in Information Technology. Electronic Dance Music is love.Also like all phone related technologies

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Python: Why None is not Nothing

[ตอนที่ 1] สร้าง Kubernetes HA-Cluster on Baremetal by KUBESPRAY

Building your first container application in GO

5 Best Flutter Instagram Templates 2021

Microservices design patterns: API Gateway, Backend for Frontend (BFF)

LeetCode 1352. Product of the Last K Numbers

Problem Statement Product of the Last K Numbers

Stack Data Structure: A First Look

Best of the Week — March 15/21

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Anubhav Mishra

Anubhav Mishra

Software Developer ,currently pursuing B.Tech in Information Technology. Electronic Dance Music is love.Also like all phone related technologies

More from Medium

Why Java is platform independent

Modelling Autonomous Beams

What Is java Date

Get Heap Dump Analysis — Faster than Maggi 😋