Hello coders, today we are going to solve Sale Season Codechef Solutions whose Problem Code is SALESEASON.
As you already know that this site does not contain only the Codefchef solutions here, you can also find the solution for other programming problems. I.e. Leetcode, C programs, C++ Programs Solutions, Python Programs, Web Technology, Data Structures, RDBMS Programs and Java Programs Solutions.

Problem
It’s the sale season again and Chef bought items worth a total of X rupees. The sale season offer is as follows:

Find the final amount Chef needs to pay for his shopping.
Input Format
- The first line of input will contain a single integer T, denoting the number of test cases.
- Each test case consists of single line of input containing an integer X.
Output Format
For each test case, output on a new line the final amount Chef needs to pay for his shopping.
Constraints
- 1 ≤ T ≤ 100
1 ≤ X ≤ 10000
Sample 1:
Input
4 15 70 250 1000
Output
15 70 225 975
LinkedIn Skill Assessment Answers
Coursera Quiz Answers
Explanation:
Test case 11: Since X \le 100X≤100, there is no discount.
Test case 33: Here, X = 250X=250. Since 100 \lt 250 \le 1000100<250≤1000, discount is of 2525 rupees. Therefore, Chef needs to pay 250-25 = 225250−25=225 rupees.
Sale Season 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(); for(int i=0; i<T; i++) { int N = sc.nextInt(); double r = 0; for(int j=0; j<N; j++) { int p = sc.nextInt(); int q = sc.nextInt(); int d = sc.nextInt(); double pp = p+((double)p*d)/100; pp = pp-(pp*d)/100; r=r+(p-pp)*q; } System.out.println(r); } } }
Sale Season Codechef Solution in CPP
#include <iostream> using namespace std; int main() { int t; cin>>t; while(t--){ int n; cin>>n; double sum=0; for(int i=1;i<=n;i++){ double p,x,d; cin>>p>>x>>d; double dis=double(d)/100; double finalp=p+(p*dis); double finalfp=finalp-(finalp*dis); double loss=x*(p-finalfp); sum+=loss; } cout<<fixed<<sum<<endl; } return 0; }
Sale Season Codechef Solution in Python
for testcases in range(int(input())): a=int(input()) count=0 for i in range(a): a,b,c=map(int,input().split()) d=a*b a+=(0.01*c*a) a-=(0.01*a*c) a*=b count+=(d-a) print(float(count))
Disclaimer: The above Problem (Sale Season ) is generated by CodeChef but the solution is provided by Chase2learn.This tutorial is only for Educational and Learning purpose.
Finally, we are now, in the end, I just want to conclude some important message for you
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.
Please share our posts on social media platforms and also suggest to your friends to Join Our Groups. Don’t forget to subscribe.