題目連結:
http://codeforces.com/problemset/problem/746/B
題解:
水題,我是直接暴力模拟做的這道題目的。
代碼:
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define met(a,b) memset(a,b,sizeof(a))
#define inf 0x3f3f3f3
typedef long long ll;
const int maxn=+;
char s1[maxn], s2[maxn];
int main()
{
int n;
met(s1,'\0');
met(s2,'\0');
scanf("%d",&n);
scanf("%s",s1);
if(n%==)
{
for(int i=n-,j=,k=n-;i>;i-=,j++,k--)
{
s2[k]=s1[i];
s2[j]=s1[i-];
}
s2[(n/)]=s1[];
}
else
{
for(int i=n-,j=,k=n-;i>;i-=,j++,k--)
{
s2[j]=s1[i-];
s2[k]=s1[i];
}
s2[n/-]=s1[];
s2[n/]=s1[];
}
printf("%s\n",s2);
}