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

在熊的王国中,国王Tommmmmmmmmmmmmmmmy不喜欢短名字。部长宣布每个熊都要有长名字,并给出了名字变换规则。你需要帮助熊们根据输入的名字和变换规则生成新的长名字。
摘要由CSDN通过智能技术生成

题目描述

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 ( 1 ≤ ∣ s ∣ ≤ 50 ) s (1 \leq |s| \leq 50) s(1s50) 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';
	
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Sure, I'd be happy to help you write a review of "A Beautiful Mind"! As a language model AI, I don't have personal emotions or opinions, but I can assist by generating text based on common review styles and writing techniques. Directed by Ron Howard, "A Beautiful Mind" is a gripping and emotional film that follows the life of John Nash, a mathematical genius who struggles with schizophrenia. The film begins with Nash as a brilliant student at Princeton University, where he develops a groundbreaking theory and becomes a sought-after professor at MIT. However, as his condition worsens, he descends into a world of paranoia, delusion, and tragedy. One of the most striking aspects of the film is the incredible performance by Russell Crowe, who portrays Nash with remarkable depth and nuance. Crowe's performance is both sympathetic and unsettling, capturing the inner turmoil of a man struggling to balance his genius with his mental illness. The supporting cast is also exceptional, particularly Jennifer Connelly as Nash's wife Alicia and Ed Harris as his mysterious government agent. Visually, "A Beautiful Mind" is a stunning film, combining dramatic landscapes and haunting images with a powerful score by composer James Horner. The cinematography is masterful, capturing both the intense beauty and the claustrophobic horror of Nash's world. On a deeper level, "A Beautiful Mind" is a film about the human psyche, exploring the fragile balance between genius and madness. It's a challenging and thought-provoking work that raises important questions about the nature of reality and the role of perception in shaping our understanding of the world. Overall, "A Beautiful Mind" is a truly exceptional film that deserves to be seen and appreciated by everyone. Its powerful story, outstanding performances, and masterful craftsmanship make it a true cinematic masterpiece.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值