2014年2月26日 星期三

NTHU OJ - 7488 哪種三角形?! (II)

The following program is my ACcepted code for NTHU-7488.
It's a for everybody to learn and discuss.
If there is any mistake or comment, please let me know.  :D

此乃NTHU 7488 的AC code!
歡迎一同討論學習,如有錯誤與任何建議請留言 : )

點這裡看題目 Click here to see this Problem!


//This program is for NTHU 7488 哪種三角形?! (II)
//http://acm.cs.nthu.edu.tw/problem.php?pid=7488

#include<stdio.h>
using namespace std;

void check(long long int x,long long  int y,long long int z)
{
    if( (x+y) <= z || (x+z) <= y || (y+z) <= x )
        printf("Oh~NO!!\n");
    else if(x == y && y == z)
        printf("3 equal\n");
    else if(x == y || y == z || x == z)
        printf("2 equal\n");
    else
        printf("OK!\n");
    return;
}

int main()
{
    int n;
    long long int edge[3];
 
    scanf("%d", &n);

    while(n--)
    {
        for(int i=0;i <3; i++)
            scanf("%lld", &edge[i]);
        check(edge[0], edge[1], edge[2]);
    }
     

    return 0;
}


Please feel free to use it after adding this blog as an reference. (http://autekroy.blogspot.tw) If there is any mistake or comment, please let me know. :D 

歡迎使用與分享任何內容,但請記得標示此部落格為出處。(http://autekroy.blogspot.tw/) 如果有發現任何的錯誤與建議請留言或跟我連絡。 : )

沒有留言:

張貼留言

請留下您的任何想法或建議!
Please leave any thought or comment!