Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
109091 汤奕硕 墓碑上的字符 C++ Accepted 1 MS 272 KB 694 2025-01-26 16:22:10

Tests(2/2):


Code:

#include <iostream> #include <string> using namespace std; int main() { int n; cin >> n; // 读取测试数据组数 cin.ignore(); // 忽略换行符,确保下一次读取时从第一组数据开始 while (n--) { string str1, str2; getline(cin, str1); // 读取第一行字符串 getline(cin, str2); // 读取第二行字符串 int mid = str1.length() / 2; // 计算第一个字符串的中间位置 // 将第二个字符串插入到第一个字符串的中间位置 string result = str1.substr(0, mid) + str2 + str1.substr(mid); cout << result << endl; // 输出结果 } return 0; }