結果

問題 No.69 文字を自由に並び替え
ユーザー n.yn.y
提出日時 2022-05-31 10:10:54
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 28 ms / 5,000 ms
コード長 1,245 bytes
コンパイル時間 800 ms
コンパイル使用メモリ 106,180 KB
実行使用メモリ 24,504 KB
最終ジャッジ日時 2023-10-21 00:33:13
合計ジャッジ時間 1,920 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
24,504 KB
testcase_01 AC 27 ms
24,504 KB
testcase_02 AC 27 ms
24,504 KB
testcase_03 AC 28 ms
24,504 KB
testcase_04 AC 27 ms
24,504 KB
testcase_05 AC 27 ms
24,504 KB
testcase_06 AC 27 ms
24,504 KB
testcase_07 AC 27 ms
24,504 KB
testcase_08 AC 28 ms
24,504 KB
testcase_09 AC 27 ms
24,504 KB
testcase_10 AC 27 ms
24,504 KB
testcase_11 AC 27 ms
24,504 KB
testcase_12 AC 27 ms
24,504 KB
testcase_13 AC 27 ms
24,504 KB
testcase_14 AC 27 ms
24,504 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Diagnostics;

namespace yukicoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //文字入力
            string A = Console.ReadLine();
            string B = Console.ReadLine();

            //strBの数と同じならばループが終わる
            int count = 0;
            for (int i = 0; i < B.Length; i++)
            {
                //文字列の一部分の取得
                string strB = B.Substring(i, 1);
                count++;

                //同じ文字列の検索
                int str = A.IndexOf(strB, 0);
                //なければ、ループが終わる NO
                if (str == -1)
                {
                    Console.WriteLine("NO");
                    break;

                }
                else
                {
                    //文字列の削除
                    A= A.Remove(str, 1);

                }

                //strB = strB.Remove(i, 1);

                //カウントが文字列と同じならばYES
                if (count==B.Length)
                {
                    Console.WriteLine("YES");
                    break;
                }



            }

        }
    }
}
0