結果

問題 No.380 悪の台本
ユーザー bluemeganebluemegane
提出日時 2021-05-12 15:05:05
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,471 bytes
コンパイル時間 4,044 ms
コンパイル使用メモリ 110,020 KB
実行使用メモリ 35,532 KB
最終ジャッジ日時 2023-10-24 04:29:51
合計ジャッジ時間 6,249 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
29,408 KB
testcase_01 WA -
testcase_02 AC 64 ms
29,608 KB
testcase_03 AC 63 ms
29,608 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
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.Text.RegularExpressions;
using System.Collections.Generic;
using System;

public class hello
{
    public static HashSet<string> hs;
    public static string ok = "CORRECT (maybe)";
    public static string ng = "WRONG!";
    static void Main()
    {
        var a0 = new string[] { "digi", "petit", "gema", "piyo" };
        hs = new HashSet<string>();
        foreach (var x in a0) hs.Add(x);
        string L;
        for (; (L = Console.ReadLine()) != null;)
        {
            string[] line = L.Trim().Split(' ');
            if (!hs.Contains(line[0])) { Console.WriteLine(); }
            {
                var lineL = line.Length;
                if (line[0] == "rabi") getAns0(line);
                else getAns(line[0],line[  lineL -1 ]);
            }
        }
    }
    static void getAns0(string[] line)
    {
        foreach(var x in line)
        {
            if (Regex.IsMatch(x, @"\W")) { Console.WriteLine(ok); return; }
        }
        Console.WriteLine(ng);
    }
    static void getAns(string a, string b)
    {
        if (!hs.Contains(a)) { Console.WriteLine(ng); return; }
        var t = b.ToLower();
        bool ans;
        if (a == "digi") ans = Regex.IsMatch(t, @"nyo\W{0,3}$");
        else if (a== "petit") ans = Regex.IsMatch(t, @"nyu\W{0,3}$");
        else if (a== "gema") ans = Regex.IsMatch(t, @"gema\W{0,3}$");
        else ans = Regex.IsMatch(t, @"pyo\W{0,3}$");
        Console.WriteLine(ans ? ok : ng);
    }
}
0