Solubility CodeChef Solution | SOLBLTY

Hello coders, today we are going to solve Solubility CodeChef Solution whose Problem Code is SOLBLTY.

Solubility CodeChef Solution | SOLBLTY


Suppose for a unit rise in temperature, the solubility of sugar in water increases by Bg100 mLBg100 mL.

Chef does an experiment to check how much sugar (in gg) he can dissolve given that he initially has 11 liter of water at XX degrees and the solubility of sugar at this temperature is Ag100 mLAg100 mL. Also, Chef doesn’t want to lose any water so he can increase the temperature to at most 100100 degrees.

Assuming no loss of water takes place during the process, find the maximum amount of sugar (in gg) can be dissolved in 11 liter of water under the given conditions.


  • The first line contains an integer TT, the number of test cases. Then the test cases follow.
  • The only line of each test case contains three integers X,A,BX,A,B.


For each testcase, output in a single line the answer to the problem.


  • 1≤T≤10001≤T≤1000
  • 31≤X≤4031≤X≤40
  • 101≤A≤120101≤A≤120
  • 1≤B≤5


Subtask #1 (100 points): Original Constraints

Sample Input

40 120 1
35 120 2
40 115 3

Sample Output



Test Case 11: Since solubility is increasing with temperature, the maximum solubility will be at 100100 degrees which is equal to 120+(100−40)=180g100 mL120+(100−40)=180g100 mL.

So for 11 liter of water the value is 180⋅10=1800 g180⋅10=1800 g.

Test Case 22: Since solubility is increasing with temperature, the maximum solubility will be at 100100 degrees which is equal to 120+(100−35)⋅2=250g100 mL120+(100−35)⋅2=250g100 mL.

So for 11 liter of water the value is 250⋅10=2500 g250⋅10=2500 g.

Solution – Solubility CodeChef Solution

Python Solution

# cook your dish here
T = int(input())
for i in range(T):
    m, n, p = map(int, input().split())
    ans = n + (100 - m) * p
    result = ans * 10

C++ Solution

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int t; cin >> t;
	    int x,a,b;
	    cin >> x >> a >> b;
	       int ans = a+(100-x)*b;
	       cout << ans*10 << "\n";
	return 0;

Java Solution

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;

/* 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
		// your code goes here
		Scanner sc = new Scanner(;
		int t = sc.nextInt();
		    int x = sc.nextInt();
		    int a = sc.nextInt();
		    int b = sc.nextInt();
		    int ans = a+(100-x)*b;

Disclaimer: The above Problem (Solubility) is generated by CodeChef but the Solution is provided by CodingBroz. This tutorial is only for Educational and Learning Purpose.

Leave a Comment

Your email address will not be published.