Sugarcane Juice Business CodeChef Solution

Problem – Sugarcane Juice Business CodeChef Solution

While Alice was drinking sugarcane juice, she started wondering about the following facts:

  • The juicer sells each glass of sugarcane juice for 50 coins.
  • He spends 20% of his total income on buying sugarcane.
  • He spends 20% of his total income on buying salt and mint leaves.
  • He spends 30% of his total income on shop rent.

Alice wonders, what is the juicer’s profit (in coins) when he sells N glasses of sugarcane juice?

Input Format

  • The first line of input will contain an integer T — the number of test cases. The description of T test cases follows.
  • The first and only line of each test case contains an integer N, as described in the problem statement.

Output Format

For each test case, output on a new line the juicer’s profit when he sells N glasses of juice.

Constraints

  • 1≤T≤1000
  • 1≤N≤10^6

Sample 1:

Input: 4
2
4
5
10
Output: 30
60
75
150

Explanation:

Test case 1: The total income is 50×2=100 coins. The juicer spends 20 coins on sugarcane, 20 coins on salt and mint leaves and 30 coins on rent. Thus, the profit is 100−(20+20+30)=30 coins.

Test case 2: The total income is 50×4=200 coins. The juicer spends 40 coins on sugarcane, 40 coins on salt and mint leaves and 60 coins on rent. Thus, the profit is 200-(40+40+60) = 60 coins.

Test case 3: The total income is 50×5=250 coins. The juicer spends 50 coins on sugarcane, 50 coins on salt and mint leaves and 75 coins on rent. Thus, the profit is 250−(50+50+75)=75 coins.

Test case 4: The total income is 50×10=500 coins. The juicer spends 100 coins on sugarcane, 100 coins on salt and mint leaves and 150 coins on rent. Thus, the profit is 500−(100+100+150)=150 coins.

Sugarcane Juice Business CodeChef Solution in C++17

#include <bits/stdc++.h>
using namespace std;

int main() {
	int t;
	cin>>t;
	
	while(t--)
	{
	  long long int n,m,a,b,c;
	  cin>>n;
	  m = n*50;
	  a = m*0.2;
	  b = m*0.2;
	  c = m*0.3;
	  cout<<m-(a+b+c)<<endl;
	}
	
	return 0;
}

Sugarcane Juice Business CodeChef Solution in Pyth 3

# cook your dish here
for _ in range(int(input())):
    n=int(input())
    print(n*15)

Sugarcane Juice Business 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
	{   
	    Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
			while(t-->0){
		    int n =sc.nextInt();
		    
		    System.out.println(n*15);
		}
	}
}
Sugarcane Juice Business CodeChef Solution Review:

In our experience, we suggest you solve this Sugarcane Juice Business 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 Sugarcane Juice Business CodeChef Solution

Find on CodeChef

Conclusion:

I hope this Sugarcane Juice Business 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 >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions

Leave a Reply

Your email address will not be published.