結果
| 問題 |
No.2358 xy+yz+zx=N
|
| コンテスト | |
| ユーザー |
Adamantite
|
| 提出日時 | 2023-06-25 03:26:04 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,127 bytes |
| コンパイル時間 | 13,472 ms |
| コンパイル使用メモリ | 169,908 KB |
| 実行使用メモリ | 191,124 KB |
| 最終ジャッジ日時 | 2024-07-02 05:42:45 |
| 合計ジャッジ時間 | 17,083 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 1 WA * 9 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (117 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.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 (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);
}
}
}
}
Adamantite