Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
17980 纪哲弘 墓碑上的字符 C++ Accepted 2 MS 752 KB 507 2021-10-10 20:27:58

Tests(2/2):


Code:

#include<iostream> #include<cstring> using namespace std; int main() { char a[9999],s[9999],e[9999]; int b,c,d; cin>>b; getchar(); while(b--){ gets(a); gets(s); strcpy(e,a); c=strlen(a); d=strlen(s); if(c%2!=0){ continue; } for(int i=0;i<c+d;i++){ if(i<c/2){ a[i]=a[i]; } else if(i<c/2+d){ a[i]=s[i-c/2]; } else{ a[i]=e[i-d]; } } for(int i=0;i<c+d;i++){ cout<<a[i]; } cout<<endl; } return 0; }