結果
| 問題 |
No.927 Second Permutation
|
| コンテスト | |
| ユーザー |
Maeda
|
| 提出日時 | 2025-04-11 17:10:54 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 930 bytes |
| コンパイル時間 | 7,491 ms |
| コンパイル使用メモリ | 172,640 KB |
| 実行使用メモリ | 35,000 KB |
| 最終ジャッジ日時 | 2025-04-11 17:11:06 |
| 合計ジャッジ時間 | 10,594 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 WA * 1 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (96 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
class Program
{
static void Main(string[] args)
{
string str = Console.ReadLine();
int[] numList = Array.ConvertAll(str.ToCharArray(), num => int.Parse(num.ToString()));
Array.Sort(numList);
Array.Reverse(numList);
for (int i = numList.Length-1; i > 0; i--)
{
if (numList[i] != numList[i - 1])
{
int change = numList[i];
numList[i] = numList[i - 1];
numList[i - 1] = change;
break;
}
}
if (numList[0] == 0 || String.Join("", numList) == str || String.Join("", numList).Length != str.Length)
{
Console.WriteLine(-1);
}
else
{
Console.WriteLine(String.Join("", numList));
}
}
}
Maeda