2013年长春区域赛

A题   (字符串处理的水题)

链接:http://acm.hdu.edu.cn/showproblem.php?pid=4813

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
const int maxn=1000+10;
char s[maxn],a[maxn][maxn];
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n,m;
        cin>>n>>m;
        cin>>s;
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++)
                a[i][j]=s[i*m+j];
        }
            for(int i=0;i<n;i++)
            {
                for(int j=0;j<m;j++)
                    printf("%c",a[i][j]);
                printf("
");
            }
    }
    return 0;
}



原文地址:https://www.cnblogs.com/wolf940509/p/6617103.html