BOJ 4153. 직각삼각형 (C)

2021. 3. 7. 22:57Problem Solving/BOJ

BOJ 4153. 직각삼각형

https://www.acmicpc.net/problem/4153

소스코드

#include <stdio.h>

int main(){

    while(1){
        int x,y,z;
        scanf("%d %d %d", &x, &y, &z);

        if(x == 0)
            break;

        int max = 0;
        if(max < x) max = x;
        if(max < y) max = y;
        if(max < z) max = z;

        if(max == x) x = 0;
        if(max == y) y = 0;
        if(max == z) z = 0;

        if(max*max == x*x + y*y + z*z)
            printf("right\n");

        else
            printf("wrong\n");
    }

}

 

반응형

'Problem Solving > BOJ' 카테고리의 다른 글

BOJ 11279. 최대 힙 (Python)  (0) 2021.02.23
BOJ 1927. 최소 힙 (Python)  (0) 2021.02.23
BOJ 2606. 바이러스 (Python)  (0) 2021.02.22
BOJ 1003. 피보나치 함수 (Python)  (0) 2021.02.19
BOJ 1764. 듣보잡 (Python)  (0) 2021.02.19