Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
3867 | 顾郁铭 | 奇偶位互换 | C++ | 通过 | 100 | 0 MS | 252 KB | 545 | 2019-12-24 23:04:16 |
#include <iostream> #include <string> using namespace std; int main() { int C, len, i = 0; string str1,str2; char temp; cin>>C; while(i<C) { cin>>str1; len = str1.length(); temp = str1[0]; str1[0] = str1[1]; str1[1] = temp; for(int j = 1; j<=(len/2-1); ++j) { temp = str1[j*2]; str1[j*2] = str1[j*2+1]; str1[j*2+1] = temp; } cout<<str1<<endl; ++i; } return 0; }