Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
26816 | 唐心 | 奇偶位互换 | C++ | Accepted | 7 MS | 736 KB | 392 | 2022-05-24 17:02:57 |
#include <iostream> #include <cstdlib> #include <cstring> using namespace std; int main() { int i,n,num1,j; char str[100]; char tempc; cin >>n; for(i=0;i<n;i++) { memset(str,0,sizeof(str)); cin >>str; num1 = strlen(str); for(j=0;j<num1;j+=2) { tempc = str[j]; str[j] = str[j+1]; str[j+1] = tempc; } cout <<str<<endl; } return 0; }