Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Chef has N slippers, L of which are left slippers and the rest are right slippers. Slippers must always be sold in pairs, where each pair contains one left and one right slipper. If each pair of slippers cost X rupees, what is the maximum amount of rupees that Chef can get for these slippers?
For each test case, output on one line the maximum amount of rupees that Chef can get by selling the slippers that are available.
Input:
4
0 0 100
10 1 0
1000 10 1000
10 7 1
Output:
0
0
10000
3
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);
#define endl "\n"
int main() {
// your code goes here
fast
int t;cin>>t;
while(t--)
{
int n,l,x;cin>>n>>l>>x;
cout<<x*min(l,n-l)<<'\n';
}
return 0;
}
# cook your dish here
for _ in range(int(input())):
x,y,z = map(int,input().split());
b = min(x-y,y)
print(b*z)
/* 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
{
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-- >0){
int n = sc.nextInt();
int l = sc.nextInt();
int x = sc.nextInt();
System.out.println(x*Math.min(l,n-l));
}
}
}
In our experience, we suggest you solve this Chef and Pairing Slippers 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 Chef and Pairing Slippers CodeChef Solution
I hope this Chef and Pairing Slippers 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 Data Science in a business context; there are no prerequisites.
Keep Learning!
More Coding Solutions >>