結果
| 問題 |
No.380 悪の台本
|
| コンテスト | |
| ユーザー |
はまやんはまやん
|
| 提出日時 | 2016-06-18 01:16:34 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,458 bytes |
| コンパイル時間 | 1,836 ms |
| コンパイル使用メモリ | 169,140 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-06 22:54:24 |
| 合計ジャッジ時間 | 2,326 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 4 WA * 4 |
ソースコード
#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)
{
int st = s.length() - post.length() - i;
if (st < 0) break;
string ss = s.substr(st);
//cout << ss << "," << post << endl;
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 (6 < s.length())
{
if (s.substr(0, 5) == "digi ")
ans = check(s.substr(5), "nyo");
else if (s.substr(0, 6) == "petit ")
ans = check(s.substr(6), "nyu");
else if (s.substr(0, 5) == "rabi ")
ans = check2(s.substr(5));
else if (s.substr(0, 5) == "gema ")
ans = check(s.substr(5), "gema");
else if (s.substr(0, 5) == "piyo ")
ans = check(s.substr(5), "pyo");
}
if (ans)
printf("CORRECT (maybe)\n");
else
printf("WRONG!\n");
}
}
はまやんはまやん