UVA Problem 10522 Solution

Problem Solving, UVa

 

 

#include <bits/stdc++.h>

#include <cmath>



using namespace std;



int main()

{

  int tc;

  cin>>tc;

 

  while (tc) {

     

    double ha, hb, hc,a,b,c;//s,s1,a1,b1,c1,a,b,c;

    scanf("%lf%lf%lf", &ha, &hb, &hc);

    

     

         a=1/ha,b=1/hb,c=1/hc;

      double s1=(a + b + c);

      double a1=(-a + b + c);

      double b1=(a - b + c);

      double c1=(a + b - c);

      double s=s1*a1*b1*c1;

       if (s <= 0)

        {

        printf("These are invalid inputs!\n");

        tc--;

          }

       else if (ha == 0 || hb == 0 || hc == 0)

      {

       printf("These are invalid inputs!\n");

       tc--;   

      }

      else {

        printf("%.3f\n", 1 / sqrt(s));

      }

     

     

    }

 

  return 0;

}

 

0 Comments

You may find interest following article

Chapter 4 Relational Algebra

Relational Algebra The part of mathematics in which letters and other general symbols are used to represent numbers and quantities in formula and equations. Ex: (x + y) · z = (x · z) + (y · z). The main application of relational algebra is providing a theoretical foundation for relational databases, particularly query languages for such databases. Relational algebra...

Chapter 3 Components of the Database System Environment

Components of the Database System Environment There are five major components in the database system environment and their interrelationships are. Hardware Software Data Users Procedures Hardware:  The hardware is the actual computer system used for keeping and accessing the database. Conventional DBMS hardware consists of secondary storage devices, usually...

Chapter 2: Database Languages and their information

Database Languages A DBMS must provide appropriate languages and interfaces for each category of users to express database queries and updates. Database Languages are used to create and maintain database on computer. There are large numbers of database languages like Oracle, MySQL, MS Access, dBase, FoxPro etc. Database Languages: Refers to the languages used to...