結果

問題 No.2358 xy+yz+zx=N
ユーザー AdamantiteAdamantite
提出日時 2023-06-25 03:07:29
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 1,989 bytes
コンパイル時間 13,616 ms
コンパイル使用メモリ 144,708 KB
実行使用メモリ 139,264 KB
最終ジャッジ日時 2023-09-14 23:00:24
合計ジャッジ時間 17,767 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 52 ms
29,004 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 53 ms
28,948 KB
testcase_07 AC 97 ms
29,248 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  Determining projects to restore...
  Restored /home/judge/data/code/main.csproj (in 144 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/

ソースコード

diff #

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>();
            for (int x = 0; x < n / 8; x++) {
                for (int y = x; y < n / 4; y++) {
                    if (y == 0) {
                        continue;
                    }
                    int a = x * y;
                    int b = x + y;
                    if ((n - a) % b == 0) {
                        int z = (n - a) / b;
                        if (z < y) {
                            break;
                        }
                        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));
                        }
                    }
                }
            }
            Console.WriteLine(list.Count);
            foreach (string s in list) {
                Console.WriteLine(s);
            }
        }
    }
}
0