結果

問題 No.69 文字を自由に並び替え
コンテスト
ユーザー 大谷祐翔
提出日時 2025-10-30 13:17:34
言語 C#
(.NET 8.0.404)
結果
AC  
実行時間 45 ms / 5,000 ms
コード長 772 bytes
コンパイル時間 6,665 ms
コンパイル使用メモリ 169,584 KB
実行使用メモリ 185,036 KB
最終ジャッジ日時 2025-10-30 13:17:43
合計ジャッジ時間 8,355 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (85 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

class Program
{
    static void Main(string[] args)
    {
        string topWord = Console.ReadLine()!;
        string bottomWord = Console.ReadLine()!;
        bool bl = false;

        foreach (char top in topWord)
        {
            bl = false;
            int count = 0;
            foreach (char bottom in bottomWord)
            {
                count++;
                if (top == bottom)
                {
                    bl = true;
                    break;
                }
            }
            if (!bl)
            {
                Console.WriteLine("NO");
                break;
            }

            bottomWord = bottomWord.Remove(count - 1, 1);
        }

        if (bl)
        {
            Console.WriteLine("YES");
        }
    }
}
0