結果
| 問題 |
No.380 悪の台本
|
| コンテスト | |
| ユーザー |
bluemegane
|
| 提出日時 | 2021-05-12 16:37:05 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,629 bytes |
| コンパイル時間 | 2,756 ms |
| コンパイル使用メモリ | 105,728 KB |
| 実行使用メモリ | 25,216 KB |
| 最終ジャッジ日時 | 2024-09-22 22:55:14 |
| 合計ジャッジ時間 | 2,662 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 3 WA * 5 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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" ,"rabi"};
var a0 = new string[] { "digi ", "gema ", "piyo ", };
hs = new HashSet<string>();
foreach (var x in a0) hs.Add(x);
string L;
for (; (L = Console.ReadLine()) != null;)
{
if (L.Length < 9) { Console.WriteLine(ng); continue; }
var name = L.Substring(0, 5);
if (name == "rabi ") getAns0(L.Substring(5));
else
{
if (hs.Contains(name)) getAns(name.Substring(0, 4), L.Substring(5));
else
{
var name2 = L.Substring(0, 6);
if (name2 == "petit ") getAns(name.Substring(0, 5), L.Substring(6));
else Console.WriteLine(ng);
}
}
}
}
static void getAns0(string t)
{
Console.WriteLine(Regex.IsMatch(t, @"\W")? ok:ng);
}
static void getAns(string a, string b)
{
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);
}
}
bluemegane