結果
問題 |
No.69 文字を自由に並び替え
|
ユーザー |
|
提出日時 | 2022-05-31 10:06:49 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,245 bytes |
コンパイル時間 | 807 ms |
コンパイル使用メモリ | 103,552 KB |
実行使用メモリ | 18,432 KB |
最終ジャッジ日時 | 2024-09-21 01:10:41 |
合計ジャッジ時間 | 1,894 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 WA * 4 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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 < A.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==A.Length) { Console.WriteLine("YES"); break; } } } } }