有些內容使用中英雙語,有些只有英文或中文。歡迎使用與分享任何內容,但先來信告知並標示此部落格為出處。
Some parts use both Chinese and English, but some parts use only one language. Feel free to share, but please contact me first and list this blog as your reference.

2014年2月26日 星期三

NTHU OJ - 7483 哪種三角形?!(I)

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

此乃NTHU 7483 的AC code!
歡迎一同討論學習,如有錯誤與任何建議請留言 : )
//This program is for NTHU 7483 哪種三角形?!(I)
//http://acm.cs.nthu.edu.tw/problem.php?pid=7483

#include<stdio.h>
using namespace std;

void check(int x, int y, 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, edge[3];
 
    while(scanf("%d", &n) != EOF)
    {
        while(n--)
        {
            for(int i=0;i <3; i++)
                scanf("%d", &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!