Solubility CodeChef Solution

Problem – Solubility CodeChef Solution

Suppose for a unit rise in temperature, the solubility of sugar in water increases by B100 mLg​.

Chef does an experiment to check how much sugar (g) he can dissolve given that he initially has 1 liter of water at X degrees and the solubility of sugar at this temperature is A100 mLg​. Also, Chef doesn’t want to lose any water so he can increase the temperature to at most 100 degrees.

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

###Input

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

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

###Constraints

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

###Subtasks Subtask #1 (100 points): Original Constraints

Sample 1:

Input:
3
40 120 1
35 120 2
40 115 3
Output:
1800
2500
2950

Explanation:

Test Case 1: Since solubility is increasing with temperature, the maximum solubility will be at 100 degrees which is equal to 120+(100−40)=180 100 mLg​.

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

Test Case 2: Since solubility is increasing with temperature, the maximum solubility will be at 100 degrees which is equal to 120+(100−35)⋅2=250100 mLg​.

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

Solubility 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 a=sc.nextInt();
	    int b=sc.nextInt();
	    int c=sc.nextInt();
	    int x=b+(100-a)*c;
	    System.out.println(x*10);
	    --t;
	}
	}
}

Solubility CodeChef Solution in C++17

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <math.h>


using namespace std;
map<long long,long long> arr;
long long m(long long t){

    if(t < 12){
       return t; 
    } 
    if(arr.find(t) != arr.end()){
        return arr[t];
    }
    
    arr[t] = max(t, (m(t/2)) + (m(t/3)) +(m(t/4)));

    return arr[t];
}

int main(){
    int t;
    cin >> t;
    for(int q = 0; q < t; q++){
        int a,b, c;
        cin>>a>>b>>c;
        cout<<(b + (100 - a)*c)*10 << "\n";
    }
    return 0;
} 

Solubility CodeChef Solution in Pyth 3

# cook your dish here

t=int(input())
for i in range(t):
    x,a,b=map(int,input().split())
    print(10*(a+(100-x)*b))
Solubility CodeChef Solution Review:

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

Find on CodeChef

Conclusion:

I hope this Solubility 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. Required fields are marked *