結果

問題 No.380 悪の台本
ユーザー HimatsubushinHimatsubushin
提出日時 2016-07-11 15:58:28
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 2,267 bytes
コンパイル時間 940 ms
コンパイル使用メモリ 106,240 KB
実行使用メモリ 19,456 KB
最終ジャッジ日時 2024-04-24 14:41:42
合計ジャッジ時間 2,068 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
18,176 KB
testcase_01 AC 25 ms
18,176 KB
testcase_02 AC 24 ms
18,048 KB
testcase_03 AC 24 ms
18,176 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 227 ms
17,152 KB
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace No380
{
    class Program
    {
        static void Main(string[] args)
        {
            string data;

            while ((data = Console.ReadLine()) != null)
            {
                bool judgment = false;

                if (data.IndexOf(' ') != -1)
                {
                    string name = data.Substring(0, data.IndexOf(' '));
                    string word = data.Substring(data.IndexOf(' '));

                    switch (name)
                    {
                        case "digi":
                            judgment = LineEnd(word.ToLower(), "nyo");
                            break;
                        case "petit":
                            judgment = LineEnd(word.ToLower(), "nyu");
                            break;
                        case "rabi":
                            string line = data.Substring(5);
                            judgment = !MarkCheck(line);
                            break;
                        case "gema":
                            judgment = LineEnd(word.ToLower(), "gema");
                            break;
                        case "piyo":
                            judgment = LineEnd(word.ToLower(), "pyo");
                            break;
                    }
                }

                if (judgment)
                    Console.WriteLine("CORRECT (maybe)");
                else
                    Console.WriteLine("WRONG!");
            }
        }

        static bool LineEnd(string word, string suffix)
        {
            if (word.LastIndexOf(suffix) == -1)
                return false;

            word = word.Substring(word.IndexOf(suffix));

            if (word.Length - suffix.Length - word.LastIndexOf(suffix) > 3)
                return false;

            if (word.Length - suffix.Length - word.LastIndexOf(suffix) > 0)
                return MarkCheck(word.Substring(suffix.Length));

            return true;
        }

        static bool MarkCheck(string mark)
        {
            foreach (char character in mark)
                if ("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".IndexOf(character) == -1)
                    return true;

            return false;
        }
    }
}
0