結果
問題 | No.2358 xy+yz+zx=N |
ユーザー | Adamantite |
提出日時 | 2023-06-25 03:27:45 |
言語 | C# (.NET 8.0.203) |
結果 |
AC
|
実行時間 | 144 ms / 2,000 ms |
コード長 | 2,261 bytes |
コンパイル時間 | 7,798 ms |
コンパイル使用メモリ | 143,856 KB |
実行使用メモリ | 164,860 KB |
最終ジャッジ日時 | 2023-09-14 23:27:02 |
合計ジャッジ時間 | 10,259 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 52 ms
29,384 KB |
testcase_01 | AC | 52 ms
29,000 KB |
testcase_02 | AC | 52 ms
29,084 KB |
testcase_03 | AC | 52 ms
29,380 KB |
testcase_04 | AC | 52 ms
31,180 KB |
testcase_05 | AC | 52 ms
29,304 KB |
testcase_06 | AC | 51 ms
29,040 KB |
testcase_07 | AC | 54 ms
29,108 KB |
testcase_08 | AC | 139 ms
36,268 KB |
testcase_09 | AC | 144 ms
34,636 KB |
testcase_10 | AC | 102 ms
30,988 KB |
testcase_11 | AC | 108 ms
33,724 KB |
testcase_12 | AC | 83 ms
164,860 KB |
コンパイルメッセージ
Determining projects to restore... Restored /home/judge/data/code/main.csproj (in 131 ms). .NET 向け Microsoft (R) Build Engine バージョン 17.0.0-preview-21470-01+cb055d28f Copyright (C) Microsoft Corporation.All rights reserved. プレビュー版の .NET を使用しています。https://aka.ms/dotnet-core-preview をご覧ください main -> /home/judge/data/code/bin/Release/net6.0/main.dll main -> /home/judge/data/code/bin/Release/net6.0/publish/
ソースコード
using System; using System.Collections.Generic; using System.Linq; namespace B_xy_yz_zx_N { internal class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); List<string> list = new List<string>(); int x = 0; while (x * x <= n) { int y = x; while(y * y <= n) { if (x + y == 0) { y++; continue; } int a = x * y; int b = x + y; if ((n - a) % b == 0) { int z = (n - a) / b; if (z < y) { y++; continue; } if (x == y && y == z) { list.Add(string.Format("{0} {1} {2}", x, y, z)); } else if (x == y) { list.Add(string.Format("{0} {1} {2}", x, y, z)); list.Add(string.Format("{0} {1} {2}", x, z, y)); list.Add(string.Format("{0} {1} {2}", z, x, y)); } else if (y == z) { list.Add(string.Format("{0} {1} {2}", x, y, z)); list.Add(string.Format("{0} {1} {2}", y, x, z)); list.Add(string.Format("{0} {1} {2}", y, z, x)); } else { list.Add(string.Format("{0} {1} {2}", x, y, z)); list.Add(string.Format("{0} {1} {2}", x, z, y)); list.Add(string.Format("{0} {1} {2}", y, x, z)); list.Add(string.Format("{0} {1} {2}", y, z, x)); list.Add(string.Format("{0} {1} {2}", z, x, y)); list.Add(string.Format("{0} {1} {2}", z, y, x)); } } y++; } x++; } Console.WriteLine(list.Count); foreach (string s in list) { Console.WriteLine(s); } } } }