题目网址:http://acm.hdu.edu.cn/showproblem.php?pid=5264
题目大意:给你一串字符串,把奇数位提出,偶数位反向提出,重组为两个字符串
题目评价:水题,无算法,直接AC无压力
代码:
#include<stdio.h>
#include<cstring>
#include<cmath>
#include<iostream>
using namespace std;
int main ()
{
int n;cin>>n;
while(n--)
{
char map[105];
scanf("%s",map);
char str1[55],str2[55];
int qw=0,as=0,zx=0,lenmap=strlen(map);
for(int i=0;i<lenmap;i++)
{
if(i%2==0){str1[qw]=map[i];qw++;}
else {str2[as]=map[i];as++;}
}
str1[qw]=str2[qw]='\0';
int len=strlen(str2);
char str3[55];
for(int i=len-1;i>=0;i--)
{
str3[zx]=str2[i];
zx++;
}
str3[zx]='\0';
cout<<str1<<endl;
cout<<str3<<endl;
}
return 0;
}