結果
| 問題 |
No.380 悪の台本
|
| コンテスト | |
| ユーザー |
はまやんはまやん
|
| 提出日時 | 2016-06-18 01:08:37 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,387 bytes |
| コンパイル時間 | 1,679 ms |
| コンパイル使用メモリ | 169,316 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-06 22:53:28 |
| 合計ジャッジ時間 | 3,206 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 2 RE * 6 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
typedef long long ll;
bool isSymbol(char c)
{
if ('a' <= c && c <= 'z') return false;
if ('A' <= c && c <= 'Z') return false;
if ('0' <= c && c <= '9') return false;
return true;
}
bool check(string s, string post)
{
rep(i, 0, 4)
{
if (s.length() - post.length() - i < 0) break;
string ss = s.substr(s.length() - post.length() - i);
bool halt = false;
rep(j, 0, post.length())
{
if (ss[j] != post[j] && ss[j] != ('A' + post[j] - 'a')) halt = true;
}
if (halt) continue;
halt = false;
rep(j, 0, i)
{
if (!isSymbol(ss[post.length() + j])) halt = true;
}
if (halt) continue;
return true;
}
return false;
}
bool check2(string s)
{
rep(i, 0, s.length()) if (isSymbol(s[i])) return true;
return false;
}
int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
string s;
while (getline(cin, s))
{
bool ans = false;
if (s.substr(0, 4) == "digi")
ans = check(s.substr(5), "nyo");
else if (s.substr(0, 5) == "petit")
ans = check(s.substr(6), "nyu");
else if (s.substr(0, 4) == "rabi")
ans = check2(s.substr(5));
else if (s.substr(0, 4) == "gema")
ans = check(s.substr(5), "gema");
else if (s.substr(0, 4) == "piyo")
ans = check(s.substr(5), "pyo");
if (ans)
printf("CORRECT (maybe)\n");
else
printf("WRONG!\n");
}
}
はまやんはまやん