[解题报告]Is this the easiest problem?

题目大意

题目原文:http://uva.onlinejudge.org/external/114/11479.pdf

背景

给三条边叫你编写一个程序判断是什么类型的三角形。

算法:

就是用if语句进行判断,然后进行输出。要注意数值的范围。

代码:

这里附上我的代码,你可以去这里提交你的代码验证你的代码是否正确。

#include<stdio.h>
int main(void)
{
    int count,n;
    double a,b,c;
    count=1;

    scanf("%d",&n);
    while(n--)
    {
        scanf("%lf %lf %lf",&a,&b,&c);
        if(a+b>c&&b+c>a&&a+c>b&&a-c<b&&a-b<c&&b-c<a&&c-a<b&&b-a<c&&c-b<a)
         {
            if(a==b&&a==c&&b==c)
            printf("Case %d: Equilateral\n", count);
            else if(a==b||b==c||c==a)
            printf("Case %d: Isosceles\n", count);
            else if(a!=b||c!=b||a!=c)
            printf("Case %d: Scalene\n", count);
        }
       else
       printf("Case %d: Invalid\n",count );
       count++;
    }
    return 0;
}

 

posted @ 2013-02-21 13:38  乱七八糟 。  阅读(108)  评论(0编辑  收藏  举报