結果

問題 No.501 穴と文字列
ユーザー Maeda
提出日時 2025-04-09 17:00:35
言語 C#
(.NET 8.0.404)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 851 bytes
コンパイル時間 8,747 ms
コンパイル使用メモリ 170,820 KB
実行使用メモリ 190,904 KB
最終ジャッジ日時 2025-04-09 17:00:47
合計ジャッジ時間 9,614 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (113 ミリ秒)。
  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)
        {
            char[] list = { 'C', 'A', 'B' };
            string[] str = Console.ReadLine().Split(' ');
            char[] charList = Enumerable.Repeat(list[1],int.Parse(str[0])).ToArray();
            int remaining = int.Parse(str[1]) - int.Parse(str[0]);
            int i = 0;
            while(remaining != 0)
            {
                if(remaining > 0)
                {
                    charList[i] = list[2];
                    remaining--;
                }
                else
                {
                    charList[i] = list[0];
                    remaining++;
                }
                i++;
            }
            Array.Sort(charList);
            string ans = string.Join("",charList);
            Console.WriteLine(ans);
        }
    }
0