10 solutions

  • 17
    @ 2025-7-9 9:11:06

    这道题是一道超难题喵!!

    这个做法是某天和@@@@等同学吃饭时(与题解毫无关系)想到的哦喵~

    既然题目要求输出字符串"Hello,World!""Hello,World!"由此很容易想到字典思路,具体分两步:

    1

    构建 dictionarydictionary 函数的作用

    先创建一个包含所有需要用到的字符(字母、数字、符号)的dictionarydictionary,后续所有字符都从这个库中取

    2

    从这个dictionarydictionary中查找并拼接字符

    逐个找到 Hello,World!Hello,World! 的每个字符在dictionarydictionary中的位置,再取出字符拼接

    ACcode:AC code:

    #include <bits/stdc++.h>
    using namespace std;
    #define int long long
    #define lod long double
    #define FastIO ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
    string res;
    string Dictionary()
    {
    	string S;
    	for (char C = 'A'; C <= 'Z'; ++C) {
    		S += C;
    	}
    	for (char C = 'a'; C <= 'z'; ++C) {
    		S += C;
    	}
    	for (char C = '0'; C <= '9'; ++C) {
    		S += C;
    	}
    	S += "!@#$%^&*()_+`-={}|[]\\:\"\",'',./<>?, ";
    	S += "喵~";
    	return S;
    }
    
    signed main()
    {
    	FastIO;
    	string StringSet = Dictionary();
    	res += StringSet[StringSet.find('H')];
    	res += StringSet[StringSet.find('e')];
    	res += StringSet[StringSet.find('l')];
    	res += StringSet[StringSet.find('l')];
    	res += StringSet[StringSet.find('o')];
    	res += StringSet[StringSet.find(',')];
    	res += StringSet[StringSet.find('W')];
    	res += StringSet[StringSet.find('o')];
    	res += StringSet[StringSet.find('r')];
    	res += StringSet[StringSet.find('l')];
    	res += StringSet[StringSet.find('d')];
    	res += StringSet[StringSet.find('!')];
    	cout << res << endl;
    	return 0;
    }
    

Information

ID
11909
Time
1000ms
Memory
128MiB
Difficulty
1
Tags
# Submissions
347
Accepted
108
Uploaded By