結果
問題 | No.2358 xy+yz+zx=N |
ユーザー |
|
提出日時 | 2023-08-17 10:21:50 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 789 ms / 2,000 ms |
コード長 | 975 bytes |
コンパイル時間 | 3,326 ms |
コンパイル使用メモリ | 112,348 KB |
実行使用メモリ | 35,532 KB |
最終ジャッジ日時 | 2024-11-26 06:21:15 |
合計ジャッジ時間 | 7,734 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;using static System.Console;using System.Linq;using System.Collections.Generic;class Program{static int NN => int.Parse(ReadLine());static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray();static string[] SList(long n) => Enumerable.Repeat(0, (int)n).Select(_ => ReadLine()).ToArray();public static void Main(){Solve();}static void Solve(){var n = NN;var ans = new List<int[]>();for (var x = 0; x <= n; ++x) for (var y = 0; y <= n; ++y){if (x == 0 && y == 0) continue;if (x * y > n) break;if ((n - x * y) % (x + y) == 0) ans.Add(new int[] { x, y, (n - x * y) / (x + y) });}WriteLine(ans.Count);WriteLine(string.Join("\n", ans.Select(ai => string.Join(" ", ai))));}}