Nine degrees OJ topic 1048: Judging the type of triangle

Source: Internet
Author: User

Title Description:

Three edges of a given triangle, a,b,c. Determines the type of the triangle.

Input:

The test data has more than one set of three edges per set of input triangles.

Output:

For each set of inputs, output right triangle, acute triangle, or obtuse triangle.

Sample input:
3: {
Sample output:
Right triangle
1#include <cstdio>2#include <cstdlib>3#include <string>4#include <cstring>5#include <algorithm>6#include <queue>7 #defineMAX 10028 #defineINF 1000029 Ten using namespacestd; One  A intMainintargcChar Const*argv[]) - { -      the     //freopen ("Input.txt", "R", stdin); -     DoubleA, B, C; -      while(SCANF ("%lf%lf%lf", &a, &b, &c)! =EOF) {     -         if(C <a) { +             DoubleTMP =C; -c =A; +A =tmp; A         } at         if(C <b) { -             DoubleTMP =C; -c =b; -b =tmp; -         } -         //printf ("%lf%lf%lf\n", a,b,c); in         DoubleCosc = c * C + A * a + b *b; -Cosc = cosc/(2Ab); to         if(Cosc = =0) { +Puts"Right Triangle"); -         } the         Else if(Cosc >0) { *Puts"Acute triangle"); $         }Panax Notoginseng         Else { -Puts"Obtuse triangle"); the         } +     } A     return 0; the     //C2 = a2 + B2-2abcosc +}

Nine degrees OJ topic 1048: Judging the type of triangle

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.