Menu
Coddy logo textTech

Right angle triangle

Coddy의 수학 수수께끼 코스 레슨 — 20개 중 16번째.

피타고라스 수 {a, b, c}는 직각 삼각형을 이룹니다. 

정수 길이의 변 {a, b, c}를 갖는 직각 삼각형의 둘레 p는 그 합인 p = a+b+c입니다.

예시:

  • {3, 4, 5} (둘레 p = 12),
  • {30, 40, 50}, {20, 48, 52}, {24, 45, 51} (둘레 p = 120).
challenge icon

챌린지

중급

a + b + c = 1000을 만족하는 피타고라스 세 수는 정확히 하나 존재합니다.

이 세 수를 리스트로 반환하는 calcSpecialPythagoreanTriplet 함수를 작성하세요.

직접 해보기

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include "solution.h"

int main() {
    int rs = 0;
    int* r = calcSpecialPythagoreanTriplet(&rs);
    for (int i = 0; i < rs; i++) {
        if (i > 0) printf(" ");
        printf("%d", r[i]);
    }
    printf("\n");
    return 0;
}

수학 수수께끼의 모든 레슨

5Diophantine Equation

IntroductionA problem

8Pythagorean triplet

IntroductionRight angle triangleCounting