Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
108932 彭士宝 墓碑上的字符 C++ Accepted 1 MS 276 KB 610 2025-01-23 16:42:39

Tests(2/2):


Code:

#include <iostream> #include <string> using namespace std; int main() { int n; cin >> n; // 读取测试数据的组数 for (int i = 0; i < n; ++i) { string str1, str2; cin >> str1 >> str2; // 读取两个字符串 // 计算第一个字符串长度的一半 int mid = str1.length() / 2; // 将第二个字符串插入到第一个字符串的正中央 string result = str1.substr(0, mid) + str2 + str1.substr(mid, str1.length() - mid); // 输出结果字符串 cout << result << endl; } return 0; }