uva11936 The Lazy Lumberjacks

952 ワード

uva11936
uDebug11936
uva入門問題.3つの整数を与え、三角形を構成できるかどうかを尋ねると、「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
",&testcase); while(testcase--) { scanf("%d%d%d
",&a,&b,&c); if(a+b>c && a+c>b && b+c>a) printf("OK
"); else printf("Wrong!!
"); } return 0; }