Hello Programmers In this post, you will know how to solve the **A Big Sale Codechef Solution**. The Problem Code: **BIGSALE**

One more thing to add, don’t directly look for the solutions, first try to solve the problems of Codechef by yourself. If you find any difficulty after trying several times, then you can look for solutions.

### Problem

Chef recently opened a big e-commerce website where her recipes can be bought online. It’s Chef’s birthday month and so she has decided to organize a big sale in which grand discounts will be provided.

In this sale, suppose a recipe should have a discount of **x** percent and its original price (before the sale) is **p**. Statistics says that when people see a discount offered over a product, they are more likely to buy it. Therefore, Chef decides to first increase the price of this recipe by **x**% (from **p**) and then offer a discount of **x**% to people.

Chef has a total of **N** types of recipes. For each **i** (1 ≤ **i** ≤ **N**), the number of recipes of this type available for sale is **quantity _{i}**, the unit price (of one recipe of this type, before the

**x**% increase) is

**price**and the discount offered on each recipe of this type (the value of

_{i}**x**) is

**discount**.

_{i}Please help Chef find the total loss incurred due to this sale, if all the recipes are sold out.

### Input

- The first line of the input contains a single integer
**T**denoting the number of test cases. The description of**T**test cases follows. - The first line of each test case contains a single integer
**N**denoting the number of recipe types. **N**lines follow. The**i**-th of these lines contains three space-separated integers**price**,_{i}**quantity**and_{i}**discount**describing the_{i}**i**-th recipe type.

### Output

For each test case, print a single line containing one real number — the total amount of money lost. Your answer will be considered correct if it has an absolute error less than 10^{-2}.

### Constraints

- 1 ≤
**T**≤ 10 - 1 ≤
**N**≤ 10^{5} - 1 ≤
**price**,_{i}**quantity**≤ 100 for each valid_{i}**i** - 0 ≤
**discount**≤ 100 for each valid_{i}**i**

### Example

### Sample Input 1

```
2
2
100 5 10
100 1 50
3
10 10 0
79 79 79
100 1 100
```

### Sample Output 1

30.000000000 3995.0081000

### A Big Sale CodeChef Solution in JAVA

import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); for (int tc = 0; tc < T; tc++) { int N = sc.nextInt(); Recipe[] recipes = new Recipe[N]; for (int i = 0; i < recipes.length; i++) { int price = sc.nextInt(); int quantity = sc.nextInt(); int discount = sc.nextInt(); recipes[i] = new Recipe(price, quantity, discount); } System.out.println(solve(recipes)); } sc.close(); } static double solve(Recipe[] recipes) { return Arrays.stream(recipes).mapToDouble( recipe -> (recipe.discount / 100.0) * (recipe.discount / 100.0) * recipe.price * recipe.quantity).sum(); } } class Recipe { int price; int quantity; int discount; Recipe(int price, int quantity, int discount) { this.price = price; this.quantity = quantity; this.discount = discount; } }

### A Big Sale CodeChef Solution in CPP

#include <iostream> #include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--){ double price,quantity,discount,newprice; double total=0; int n; cin>>n; for(int i=0;i<n;i++){ cin>>price>>quantity>>discount; newprice=price+((price*discount)/100); newprice=newprice-((newprice*discount)/100); total+=(price-newprice)*quantity; } cout<<fixed<<setprecision(8)<<total<<endl; } return 0; }

### A Big Sale CodeChef Solution in Python

for _ in range(int(input())): a=[] loss=0 for k in range(int(input())): b=[int(i) for i in input().split()] a.append(b) up=b[0]+(b[2]*b[0])/100 sp=up-(up*b[2])/100 loss+=b[0]*b[1]-sp*b[1] print(loss)

** Disclaimer: **The above Problem

**(A Big Sale)**is

**generated by**

**CodeChef**but the solution is provided by

**BrokenProgrammers**. This tutorial is only for Educational and Learning purposes.

**Note:-** I compile all programs, if there is any case program is not working and showing an error please let me know in the comment section. If you are using adblocker, please disable adblocker because some functions of the site may not work correctly.

**Next**: Brackets Codechef Solution