题目描述
Given an integer k greater than 1, it is possible to prove that there are infinitely many triples of positive integers (a,b,c) that satisfy the following equation:
a2+b2+c2=k(ab+bc+ca)+1
Given positive integers n and k, find n arbitrary triples (a1,b1,c1),(a2,b2,c2),⋯,(an,bn,cn) that all
satisfy the equation. Furthermore, all 3n integers (a1,b1,c1),(a2,b2,c2),⋯,(an,bn,cn) should be different positive integers with at most 100 decimal digits each.
输入格式
The first line contains two integers k and n(2≤k≤1000,1≤n≤1000) — the constant k in the
equation and the target number of triples.
输出格式
Output n lines. The i-th line should contain three space separated integers ai, bi and ci with at most 100 digits each — the i-th of the solutions you found.
题目大意
题目描述:
假设 k 大于 1,
可以证明有无穷多个正整数三元组 (a,b,c) 满足以下方程:
a2+b2+c2=k(ab+bc+ca)+1
给定正整数 n 和 k,找出 n 个三元组 (a1,b1,c1),(a2,b2,c2),⋯,(an,bn,cn) 使它们都满足方程。另外,这 3n 个正整数 (a1,b1,c1),(a2,b2,c2),⋯,(an,bn,cn) 应该是不同的,每个数最多有 100 位。
输入格式:
第一行包含两个整数:
方程中的常数 k 和
所求三元组的数量 n (2≤k≤1000,1≤n≤1000);
输出格式:
输出有 n 行。第 i 行应该包含三个空格分隔的正整数 ai, bi 和 ci,
为你找到的第 i 个解。每个数最多 100 位。