結果

問題 No.2358 xy+yz+zx=N
ユーザー LyricalMaestro
提出日時 2025-04-12 17:19:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,083 ms / 2,000 ms
コード長 757 bytes
コンパイル時間 575 ms
コンパイル使用メモリ 82,772 KB
実行使用メモリ 81,008 KB
最終ジャッジ日時 2025-04-12 17:19:09
合計ジャッジ時間 7,612 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

## https://yukicoder.me/problems/no/2358


def main():
    N = int(input())

    answer = []
    for z in range(N + 1):

        for p in range(N + 1):
            if (z + p) ** 2 > N + z ** 2:
                break

            o = N + z ** 2
            if z + p == 0:
                continue

            if o % (z + p) == 0:
                zq = o // (z + p)
                x = p
                y = zq - z
                if y >= 0:
                    if x != y:
                        answer.append((x, y, z))
                        answer.append((y, x, z))
                    else:
                        answer.append((x, y, z))
    print(len(answer))
    for x, y, z in answer:
        print(x, y, z)



if __name__ == "__main__":
    main()
0