問題一覧 > 通常問題

No.1626 Constructing Triangles

レベル : / AI推定難易度 : 2050 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / スペシャルジャッジ問題 (複数の解が存在する可能性があります)
タグ : (AC するまで非表示) / 解いたユーザー数 47
作問者 : null / テスター : otera sak
お気に入りにしたユーザー ProblemId : 6473 / 自分の提出
問題文最終更新日: 2022-04-25 23:41:40
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 306 (順位表) の他の問題:

Problem Statement

Construct all (multi)sets $\{a, b, c\}$ of $3$ positive integers satisfying the following conditions, and report them along with their count.

  • $0 < a, b, c \le 10^9$
  • There exists a triangle whose $3$ sides have lengths $a, b, c$ respectively, and its area is $S$.
  • $a+b+c=T$
  • You are given $t$ test cases.

    Constraints

  • $1 \le t \le 20$
  • $1 \le S \le 7.5 \times 10^8$
  • $3 \le T \le 3 \times 10^9$
  • All inputs are integers.
  • Input

    First, the number of test cases $t$ is given.
    $t$
    
    Then, over the following $t$ lines, each test case is given on one line in the following format.
    $S\ T$
    

    Output

    For each test case, first output the number of (multi)sets $\{a, b, c\}$ of $3$ positive integers satisfying the conditions. Then, output all the sets. Separate the numbers with spaces or newlines.

    Sample

    Sample 1
    Input
    6
    6 12
    6 12
    60 60
    1 3
    23760 864
    23760 864
    
    Output
    1
    3 4 5
    1
    5 3 4
    1
    29 25 6
    0
    2
    135 352 377
    132 366 366
    2
    132 366 366
    135 352 377
    

    The area of the right triangle with $3$ sides $3, 4, 5$ is $6$.

    The order of the integers within a set and the order of the sets do not matter.

    提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。