結果
| 問題 |
No.380 悪の台本
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-07-08 16:03:03 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,035 bytes |
| コンパイル時間 | 966 ms |
| コンパイル使用メモリ | 105,728 KB |
| 実行使用メモリ | 21,760 KB |
| 最終ジャッジ日時 | 2024-11-06 23:06:36 |
| 合計ジャッジ時間 | 2,280 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 2 WA * 6 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
namespace No380
{
class Program
{
static void Main(string[] args)
{
string data;
while ((data = Console.ReadLine()) != null)
{
string[] word = data.Split(' ');
string lastWord = word[word.Length - 1];
bool judgment = false;
switch (word[0])
{
case "digi":
judgment = LineEnd(lastWord.ToLower(), "nyo");
break;
case "petit":
judgment = LineEnd(lastWord.ToLower(), "nyu");
break;
case "rabi":
string line = data.Substring(5);
judgment = !MarkCheck(line);
break;
case "gema":
judgment = LineEnd(lastWord.ToLower(), "gema");
break;
case "piyo":
judgment = LineEnd(lastWord.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;
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;
}
}
}