原创 多校训练第1轮.E——Everybody deserves a long long name【恶心人的模拟】

题目描述

In the Kingdom of Bears, the King Tommmmmmmmmmmmmmmmy has a very strange hobby: he dislike all names with length less than 1010! In fact every time he see who has a short name, he’d be so angry that he refuse to speak in the next 998244353998244353 days!

But Tommmmmmmmmmmmmmmmy the King is essential for the Kingdom of Bears, so the Minister of civil affair, Pneumonoultramicroscopicsilicovolcanoconiosis, announces that: every bear should have a long long name! Renaming is hard for bears, so Pneumonoultramicroscopicsilicovolcanoconiosis uses a sequence of methods to show the rules of renaming as follow:

If first letter of the name is not 'g', reverse the name, else append 'h' after the name.
If last letter of the name is not 'y' and first letter of the name is 'w', append 'j' after the name, else append 't' after the name.
If length of the name is not greater than 42, append 'u' after the name, else do nothing.
If last letter of the name is not 'v', reverse the name, else append 'd' after the name.
If length of the name is not greater than 43, append 'o' after the name, else append 'q' after the name.
If first letter of the name is not 'm', reverse the name, else reverse the name.
If last letter of the name is 'x', do nothing, else append 's' after the name.
If length of the name is less than 22, append 'n' after the name, else append 't' after the name.
If first letter of the name is not 'i', do nothing, else reverse the name.
If last letter of the name is 'c', append 'e' after the name, else append 'a' after the name.
If length of the name is not 42 and last letter of the name is 'v', append 'u' after the name, else do nothing.
If length of the name is not less than 47, append 'j' after the name, else reverse the name.
If first letter of the name is not 'v', append 'e' after the name, else append 'd' after the name.
If last letter of the name is 'y', append 'w' after the name, else reverse the name.
If first letter of the name is 'u', reverse the name, else append 'i' after the name.
If length of the name is not less than 32, append 'w' after the name, else do nothing.
If last letter of the name is not 'i' and first letter of the name is 'd', append 'a' after the name, else reverse the name.
If last letter of the name is not 'y', reverse the name, else do nothing.
If first letter of the name is 'y', append 'v' after the name, else reverse the name.
If length of the name is greater than 50, do nothing, else append 'm' after the name.
If last letter of the name is 't', append 'w' after the name, else append 'q' after the name.
If first letter of the name is 't', append 'e' after the name, else do nothing.
If length of the name is greater than 48, append 'l' after the name, else reverse the name.
If last letter of the name is 'y', append 'w' after the name, else reverse the name.
If length of the name is not less than 18 and first letter of the name is not 'b', reverse the name, else append 'c' after the name.
If length of the name is greater than 18, append 'y' after the name, else do nothing.
If last letter of the name is not 'g', append 'a' after the name, else reverse the name.
If first letter of the name is 'q', do nothing, else append 'i' after the name.
If last letter of the name is 'n' and length of the name is not less than 38, append 'o' after the name, else append 'v' after the name.
If first letter of the name is not 'n', do nothing, else append 'z' after the name.
If length of the name is 21 and first letter of the name is not 'm', append 'u' after the name, else append 'o' after the name.
If length of the name is 34, do nothing, else append 'z' after the name.
If first letter of the name is not 'r', reverse the name, else reverse the name.
If length of the name is greater than 25, append 'c' after the name, else reverse the name.
If first letter of the name is not 'u', append 'k' after the name, else append 'l' after the name.
If length of the name is less than 41, reverse the name, else append 'p' after the name.
If first letter of the name is not 'p', reverse the name, else append 'z' after the name.
If length of the name is less than 4 and last letter of the name is 'p', reverse the name, else append 'l' after the name.
If length of the name is not 16 and first letter of the name is 'w', append 'r' after the name, else append 'o' after the name.
If last letter of the name is 'c', append 'p' after the name, else append 'i' after the name.
If length of the name is not 20, append 'p' after the name, else reverse the name.
If last letter of the name is not 'b', reverse the name, else append 'p' after the name.
If first letter of the name is not 'c', append 'n' after the name, else append 'l' after the name.
If length of the name is not greater than 40, append 'd' after the name, else do nothing.
If first letter of the name is 'g', append 'y' after the name, else append 'i' after the name.
If last letter of the name is 'k', reverse the name, else append 'v' after the name.
If length of the name is not 20 and first letter of the name is not 'u', reverse the name, else reverse the name.
If length of the name is not greater than 46, append 'v' after the name, else append 'f' after the name.
If first letter of the name is not 'i', do nothing, else append 'z' after the name.
If length of the name is not less than 38, reverse the name, else append 'b' after the name.

But it is still very hard for bears to do the transforms precisely. So they ask you - a human who can use computer program - to solve the request. Can you help them?


输入格式

Input contains single string s(1s50)s (1 \leq |s| \leq 50)s(1≤∣s∣≤50) consists of lowercase English letter - the original name your program need to operate.


输出格式

Output the desired name in a single line.


输入

winnie

tommmmmmmmmmmmmmmmy

pneumonoultramicroscopicsilicovolcanoconiosis


输出

vidniansutwinnieoemqcaivozkloipvb

vpiolkcqmeoymmmmmmmmmmmmmmmmottustaiyavozniv

fpiolzoviaylqejatstpneumonoultramicroscopicsilicovolcanoconiosisqiwckpniv


说明/提示

The statement may be too narrow to show all content clearly. You are allowed to copy it from the website to local editor for convenience.


题意

  • 给你一个字符串,和50条操作,让你输出操作后的字符串

题解

  • QAQ,我哭了
  • 本题灵感来源于 AIM Tech Poorly Prepared Contest 里的 Keep talking and nobody explodes 三道题,但是因为出题人水平低所以模仿得很拙劣。
  • 本题本意是想写一个 parser 来处理这段内容,翻译为代码。
  • 当然考虑到如果作为输入文件的话,题目难度(相对来说)太高,因此就放了 50 句话在题面里,希望大家各显神通。
  • 做法有以下几种:
    1. 喊代码手过来好好照着抄 50 句话。代码复杂度 O( 没有一发 AC 的话代码手想打人 )。
    2. 写一个 parser 来翻译。代码复杂度 O( 还行 )
    3. 使用编辑器的查找替换功能删掉一些无用的话,比如 ‘of the name’, ‘after the name’ 啥的,再抄 / 用 parser 来翻译。代码复杂度 O( 感觉可以 )。
    4. 进一步替换,发现这个语言的顺序和大多数程序语言非常接近,甚至在一系列替换后可以除了括号
      都换好,只需要改 50 个分号。代码复杂度 O(50)。
  • 下面给出一种可能的替换为 C++ 的替换序列:
    • of ther name,after ther name,do nothing → ×
    • is greater than, is not greater than, is less than, is not less than → >, <=, <, >=
    • is, is not → ==, ! =
    • first letter, last letter → name.front(), name.back()
    • append → name +=
    • reverse the name → reverse(name.begin(), name.end())
    • If → if (
    • , → ;

AC-Code

#include <bits/stdc++.h>
using namespace std;
int main() {
	string name;
	cin >> name;
	if ((name.front() != 'g')) reverse(name.begin(), name.end());
	else name += 'h';
	if ((name.back() != 'y') && (name.front() == 'w')) name += 'j';
	else name += 't';
	if (!(name.size() > 42)) name += 'u';
	else;
	if ((name.back() != 'v')) reverse(name.begin(), name.end());
	else name += 'd';
	if (!(name.size() > 43)) name += 'o';
	else name += 'q';
	if ((name.front() != 'm')) reverse(name.begin(), name.end());
	else reverse(name.begin(), name.end());
	if ((name.back() == 'x'));
	else name += 's';
	if ((name.size() < 22)) name += 'n';
	else name += 't';
	if ((name.front() != 'i'));
	else reverse(name.begin(), name.end());
	if ((name.back() == 'c')) name += 'e';
	else name += 'a';
	if (!(name.size() == 42) && (name.back() == 'v')) name += 'u';
	else;
	if (!(name.size() < 47)) name += 'j';
	else reverse(name.begin(), name.end());
	if ((name.front() != 'v')) name += 'e';
	else name += 'd';
	if ((name.back() == 'y')) name += 'w';
	else reverse(name.begin(), name.end());
	if ((name.front() == 'u')) reverse(name.begin(), name.end());
	else name += 'i';
	if (!(name.size() < 32)) name += 'w';
	else;
	if ((name.back() != 'i') && (name.front() == 'd')) name += 'a';
	else reverse(name.begin(), name.end());
	if ((name.back() != 'y')) reverse(name.begin(), name.end());
	else;
	if ((name.front() == 'y')) name += 'v';
	else reverse(name.begin(), name.end());
	if ((name.size() > 50));
	else name += 'm';
	if ((name.back() == 't')) name += 'w';
	else name += 'q';
	if ((name.front() == 't')) name += 'e';
	else;
	if ((name.size() > 48)) name += 'l';
	else reverse(name.begin(), name.end());
	if ((name.back() == 'y')) name += 'w';
	else reverse(name.begin(), name.end());
	if (!(name.size() < 18) && (name.front() != 'b')) reverse(name.begin(), name.end());
	else name += 'c';
	if ((name.size() > 18)) name += 'y';
	else;
	if ((name.back() != 'g')) name += 'a';
	else reverse(name.begin(), name.end());
	if ((name.front() == 'q'));
	else name += 'i';
	if ((name.back() == 'n') && !(name.size() < 38)) name += 'o';
	else name += 'v';
	if ((name.front() != 'n'));
	else name += 'z';
	if ((name.size() == 21) && (name.front() != 'm')) name += 'u';
	else name += 'o';
	if ((name.size() == 34));
	else name += 'z';
	if ((name.front() != 'r')) reverse(name.begin(), name.end());
	else reverse(name.begin(), name.end());
	if ((name.size() > 25)) name += 'c';
	else reverse(name.begin(), name.end());
	if ((name.front() != 'u')) name += 'k';
	else name += 'l';
	if ((name.size() < 41)) reverse(name.begin(), name.end());
	else name += 'p';
	if ((name.front() != 'p')) reverse(name.begin(), name.end());
	else name += 'z';
	if ((name.size() < 4) && (name.back() == 'p')) reverse(name.begin(), name.end());
	else name += 'l';
	if (!(name.size() == 16) && (name.front() == 'w')) name += 'r';
	else name += 'o';
	if ((name.back() == 'c')) name += 'p';
	else name += 'i';
	if (!(name.size() == 20)) name += 'p';
	else reverse(name.begin(), name.end());
	if ((name.back() != 'b')) reverse(name.begin(), name.end());
	else name += 'p';
	if ((name.front() != 'c')) name += 'n';
	else name += 'l';
	if (!(name.size() > 40)) name += 'd';
	else;
	if ((name.front() == 'g')) name += 'y';
	else name += 'i';
	if ((name.back() == 'k')) reverse(name.begin(), name.end());
	else name += 'v';
	if (!(name.size() == 20) && (name.front() != 'u')) reverse(name.begin(), name.end());
	else reverse(name.begin(), name.end());
	if (!(name.size() > 46)) name += 'v';
	else name += 'f';
	if ((name.front() != 'i'));
	else name += 'z';
	if (!(name.size() < 38)) reverse(name.begin(), name.end());
	else name += 'b';
	cout << name << endl;
}
原创 多校训练第1轮.E——Everybody deserves a long long name【恶心人的模拟】原创 多校训练第1轮.E——Everybody deserves a long long name【恶心人的模拟】 nirvana · rebirth 发布了203 篇原创文章 · 获赞 130 · 访问量 2万+ 私信 关注
上一篇:伪元素选择器


下一篇:回文素数