Solubility - CodeChef Solution in Java | May Challenge 2021 Division 3 | Shaurya Coder

Solubility ! In C++    May Challenge 2021 Division 3







Problems

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

Chef does an experiment to check how much sugar (in 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 Ag100 mL. 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 (in 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

  • 1T1000
  • 31X40
  • 101A120
  • 1B5

Subtasks

Subtask #1 (100 points): Original Constraints

Sample Input

3
40 120 1
35 120 2
40 115 3

Sample 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+(10040)=180g100 mL.

So for 1 liter of water the value is 18010=1800 g.

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

So for 1 liter of water the value is 25010=2500 g.

Solution


#include<iostream>
using namespace std;
int main(){
    int n;
    cin>>n;
    for(int i=0; i<n; i++){
        int x, a, b;
        cin>>x>>a>>b;
        if((31<=x<=40) && (101<=a<=120) && (1<=b<=5)){
            int ans=a+(100-x)*b;
           cout<<ans*10<<endl;
         }
    }
    return 0;
}

Post a Comment

Previous Post Next Post