結果
問題 |
No.1367 文字列門松
|
ユーザー |
![]() |
提出日時 | 2021-02-02 20:16:04 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 27 ms / 2,000 ms |
コード長 | 661 bytes |
コンパイル時間 | 3,043 ms |
コンパイル使用メモリ | 112,188 KB |
実行使用メモリ | 18,560 KB |
最終ジャッジ日時 | 2024-06-29 23:52:29 |
合計ジャッジ時間 | 3,594 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System.Collections.Generic; using System; public class Hello { public static string t = "kadomatsu"; static void Main() { var s = Console.ReadLine().Trim(); Console.WriteLine(getAns(s) ? "Yes" : "No"); } static bool getAns(string s) { var sL = s.Length; if (sL == 10) return false; if (sL == 9) return s == t; var test = new List<int>(); var p = 0; for (int i = 0; i < sL; i++) { var w = t.IndexOf(s[i].ToString(), p); if (w == -1) return false; test.Add(w); p = w + 1; } return true; } }