結果

問題 No.927 Second Permutation
ユーザー ngtkana
提出日時 2020-02-06 12:56:57
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 567 bytes
コンパイル時間 1,033 ms
コンパイル使用メモリ 104,960 KB
実行使用メモリ 18,816 KB
最終ジャッジ日時 2024-09-25 06:44:49
合計ジャッジ時間 5,823 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 2 WA * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;
using System.Collections.Generic;

static class NagataKanaIsAGenius {
    public static void Main() {
        char[]s=Console.ReadLine().ToArray();
        if(s.Length==2&&s[1]=='0'){
            Console.WriteLine(-1);
            Environment.Exit(0);
        }
        Array.Sort(s);
        Array.Reverse(s);
        s[s.Length-2]^=s[s.Length-1];
        s[s.Length-1]^=s[s.Length-2];
        s[s.Length-2]^=s[s.Length-1];
        foreach(char c in s){
            Console.Write(c);
        }
        Console.WriteLine("");
    }
}
0