uva11936 The Lazy Lumberjacks

uva11936

uDebug11936

uva入门题。 给定三个整数,问是否能构成三角形,可以,则输出‘OK’,否则就输出‘Wrong!!’。

python版本AC代码

testcase = int(input())
while testcase > 0:
	testcase -= 1
	a,b,c = map(int,input().split())
	if a+b>c and a+c>b and b+c>a:
		print('OK')
	else:
		print('Wrong!!')

C++版本AC代码

#include 
#include
using namespace std;

//#define ZANGFONG

int main()
{
    #ifdef ZANGFONG
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
    #endif // ZANGFONG
    int testcase,a,b,c;
    scanf("%d\n",&testcase);
    while(testcase--)
    {
        scanf("%d%d%d\n",&a,&b,&c);
        if(a+b>c && a+c>b && b+c>a) printf("OK\n");
        else printf("Wrong!!\n");
    }
    return 0;
}

 

你可能感兴趣的:(uva11936 The Lazy Lumberjacks)