結果

問題 No.2358 xy+yz+zx=N
ユーザー AdamantiteAdamantite
提出日時 2023-06-25 03:09:54
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 1,999 bytes
コンパイル時間 8,941 ms
コンパイル使用メモリ 144,812 KB
実行使用メモリ 40,484 KB
最終ジャッジ日時 2023-09-14 23:04:01
合計ジャッジ時間 13,816 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
28,936 KB
testcase_01 AC 51 ms
29,112 KB
testcase_02 AC 52 ms
28,924 KB
testcase_03 AC 52 ms
28,936 KB
testcase_04 WA -
testcase_05 AC 53 ms
29,204 KB
testcase_06 AC 53 ms
28,984 KB
testcase_07 AC 109 ms
29,076 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  Determining projects to restore...
  Restored /home/judge/data/code/main.csproj (in 128 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 + 1; x++) {
                for (int y = x; y <= n / 4 + 1; 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