Algorithm
problem Link : https://www.codechef.com/problems/SUGARCANE
Problem
While Alice was drinking sugarcane juice, she started wondering about the following facts:
- The juicer sells each glass of sugarcane juice for coins.
- He spends of his total income on buying sugarcane.
- He spends of his total income on buying salt and mint leaves.
- He spends of his total income on shop rent.
Alice wonders, what is the juicer's profit (in coins) when he sells glasses of sugarcane juice?
Input Format
- The first line of input will contain an integer — the number of test cases. The description of test cases follows.
- The first and only line of each test case contains an integer , as described in the problem statement.
Output Format
For each test case, output on a new line the juicer's profit when he sells glasses of juice.
Constraints
Sample 1:
4 2 4 5 10
30 60 75 150
Explanation:
Test case : The total income is coins. The juicer spends coins on sugarcane, coins on salt and mint leaves and coins on rent. Thus, the profit is coins.
Test case : The total income is coins. The juicer spends coins on sugarcane, coins on salt and mint leaves and coins on rent. Thus, the profit is coins.
Test case : The total income is coins. The juicer spends coins on sugarcane, coins on salt and mint leaves and coins on rent. Thus, the profit is coins.
Test case : The total income is coins. The juicer spends coins on sugarcane, coins on salt and mint leaves and coins on rent. Thus, the profit is coins.
Code Examples
#1 Code Example with C Programming
Code -
C Programming
#include<stdio.h>
int main()
{
int t,profit,n,total,rent,buy,salt;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
profit=n*50-n*50*.2-n*50*.2-n*50*.3;
printf("%d\n",profit);
}
}
Copy The Code &
Try With Live Editor
Input
2
4
5
10
Output
60
75
150
Demonstration
CodeChef solution SUGERCANE - Sugarcane Juice Business Codechef solution in C,C++