您的位置:首页 > 其它

hdu 4813(2013长春现场赛A题)

2015-10-02 16:22 483 查看


把一个字符串分成N个字符串 每个字符串长度为m

Sample Input
1
2 5 // n m
klmbbileay

Sample Output
klmbb
ileay

 

# include <iostream>
# include <cstdio>
# include <cstring>
# include <algorithm>
# include <string>
# include <cmath>
# include <queue>
# include <list>
# define LL long long
using namespace std ;

char s[2000] ;

int main()
{
//freopen("in.txt","r",stdin) ;
int T ;
scanf("%d" , &T) ;
while(T--)
{
int n , m ;
scanf("%d %d" , &n ,&m) ;
int i , j ;
int cnt = 0 ;
scanf("%s" , s) ;
for (i = 0 ; i < n ; i++)
{
for (j = 0 ; j < m ; j++)
printf("%c" , s[cnt++]) ;
printf("\n") ;
}

}

return 0;
}
View Code

 

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: