码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2015-10-02 17:24:23      阅读:160      评论:0      收藏:0      [点我收藏+]

标签:


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

Sample Input
1
2 5 // n m
klmbbileay

Sample Output
klmbb
ileay

 

技术分享
 1 # include <iostream>
 2 # include <cstdio>
 3 # include <cstring>
 4 # include <algorithm>
 5 # include <string>
 6 # include <cmath>
 7 # include <queue>
 8 # include <list>
 9 # define LL long long
10 using namespace std ;
11 
12 char s[2000] ;
13 
14 int main()
15 {
16     //freopen("in.txt","r",stdin) ;
17     int T ;
18     scanf("%d" , &T) ;
19     while(T--)
20     {
21         int n , m ;
22         scanf("%d %d" , &n ,&m) ;
23         int i , j ;
24         int cnt = 0 ;
25         scanf("%s" , s) ;
26         for (i = 0 ; i < n ; i++)
27         {
28             for (j = 0 ; j < m ; j++)
29                 printf("%c" , s[cnt++]) ;
30             printf("\n") ;
31         }
32 
33 
34     }
35 
36     return 0;
37 }
View Code

 

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

标签:

原文地址:http://www.cnblogs.com/-Buff-/p/4852362.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!