using System.Text; using System.Collections.Generic; using System; public class P { public int x { get; set; } public int y { get; set; } public int z { get; set; } } public class Hello { static void Main() { var n = int.Parse(Console.ReadLine().Trim()); getAns(n); } static void print(List
ps) { var c = 0; var sb = new StringBuilder(); foreach (var x in ps) { if (x.x == x.y && x.y == x.z) { c++; sb.Append(string.Format("{0} {1} {2}\n", x.x, x.y, x.z)); } else if (x.x == x.y) { c += 3; sb.Append(string.Format("{0} {1} {2}\n", x.x, x.y, x.z)); sb.Append(string.Format("{0} {1} {2}\n", x.x, x.z, x.y)); sb.Append(string.Format("{0} {1} {2}\n", x.z, x.x, x.y)); } else if (x.y == x.z) { c += 3; sb.Append(string.Format("{0} {1} {2}\n", x.x, x.y, x.z)); sb.Append(string.Format("{0} {1} {2}\n", x.y, x.x, x.z)); sb.Append(string.Format("{0} {1} {2}\n", x.y, x.z, x.x)); } else { c += 6; sb.Append(string.Format("{0} {1} {2}\n", x.x, x.y, x.z)); sb.Append(string.Format("{0} {1} {2}\n", x.x, x.z, x.y)); sb.Append(string.Format("{0} {1} {2}\n", x.y, x.x, x.z)); sb.Append(string.Format("{0} {1} {2}\n", x.y, x.z, x.x)); sb.Append(string.Format("{0} {1} {2}\n", x.z, x.x, x.y)); sb.Append(string.Format("{0} {1} {2}\n", x.z, x.y, x.x)); } } Console.WriteLine(c); Console.Write(sb); } static void getAns(int n) { var ps = new List
(); for (int i = 0; i * i <= n; i++) { for (int j = i; j * j <= n; j++) { if (i == 0 && j == 0) continue; var w = n - i * j; if (w % (i + j) == 0) { var z = w / (i + j); if (z >= j) ps.Add(new P { x = i, y = j, z = z }); } } } print(ps); } }