2562:奇偶位互换

来源:互联网 发布:游族网络2018校园招聘 编辑:程序博客网 时间:2024/06/05 11:26

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2562

方法:无

思路:超级大水题,直接按要求做就行,在此知识记录一下代码。

难点:无

#include<iostream>#include<cstdio>#include<string.h>using namespace std;int main(){    int t;    char str[100];    while(cin>>t)    {        while(t--)        {            scanf("%s",&str);            int l = strlen(str);            for(int i = 0;i <= l;i = i+2)            {                char t;                t = str[i];                str[i] = str[i+1];                str[i+1] = t;            }            printf("%s\n",str);        }    }}


0 0