結果
| 問題 |
No.380 悪の台本
|
| コンテスト | |
| ユーザー |
mban
|
| 提出日時 | 2017-01-10 01:31:05 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 4,306 bytes |
| コンパイル時間 | 959 ms |
| コンパイル使用メモリ | 110,464 KB |
| 実行使用メモリ | 24,320 KB |
| 最終ジャッジ日時 | 2024-11-06 23:19:35 |
| 合計ジャッジ時間 | 2,210 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;
class Magatro
{
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string abc = "abcdefghijklmnopqrstuvwxyz";
static void Main()
{
using(var sr=new StreamReader(Console.OpenStandardInput()))
{
while (!sr.EndOfStream)
{
string s = sr.ReadLine();
string[] ss = s.Split(' ');
string name = ss[0];
List<string> sp = new List<string>();
for(int i = 1; i < ss.Length; i++)
{
sp.Add(ss[i]);
}
string speak =ToSmall( string.Join(" ", sp.ToArray()));
Console.WriteLine(ans(name, speak));
}
}
}
static string ans(string name,string speak)
{
bool a = false;
switch (name)
{
case "digi":
a = last(speak, "nyo");
break;
case "petit":
a = last(speak, "nyu");
break;
case "rabi":
foreach (char c in abc)
{
if (speak.Contains(c))
{
a = true;
break;
}
}
for(int i = 0; i <= 9; i++)
{
if(speak.Contains(i.ToString()))
{
a = true;
break;
}
}
if(speak.Contains(' '))
{
a = true;
break;
}
a = false;
break;
case "gema":
a = last(speak, "gema");
break;
case "piyo":
a = last(speak, "pyo");
break;
}
if (a)
{
return("CORRECT (maybe)");
}
else
{
return("WRONG!");
}
}
static bool last(string S,string last)
{
int ind = 0;
if (S.Length < 3)
{
return false;
}
for(int i = 1; i <= 3; i++)
{
if( abc.Contains(S[S.Length - i]))
{
break;
}
ind++;
}
if (S.Length - ind < last.Length)
{
return false;
}
for(int i = 0; i < last.Length; i++)
{
if (S[S.Length - 1 - ind - i] != last[last.Length - i - 1])
{
return false;
}
}
return true;
}
static string ToSmall(string S)
{
char[] C = S.ToArray();
for(int i = 0; i < C.Length; i++)
{
int ind = ABC.IndexOf(C[i]);
if (ind >= 0)
{
C[i] = abc[ind];
}
}
return new string(C);
}
}
public class Scanner
{
public string[] S;
private int Index;
private char Separator;
public Scanner(char separator=' ')
{
Index = 0;
Separator = separator;
}
public string Next()
{
string result;
if (S == null || Index >= S.Length)
{
S = Line();
Index = 0;
}
result = S[Index];
Index++;
return result;
}
public string NextLine()
{
if (Index >= S.Length)
{
S = Line();
Index = 0;
}
List<string> res = new List<string>();
for(int i = Index; i < S.Length; i++)
{
res.Add(S[i]);
}
Index = S.Length;
return string.Join(Separator.ToString(), res.ToArray());
}
private string[] Line()
{
return Console.ReadLine().Split(Separator);
}
public int NextInt()
{
return int.Parse(Next());
}
public double NextDouble()
{
return double.Parse(Next());
}
public long NextLong()
{
return long.Parse(Next());
}
}
mban