做一个正气的杭电人

Problem Description
做人要有一身正气,杭电学子都应该如此。比如我们今天的考试就应该做到“诚信”为上。
每次考试的第一个题目总是很简单,今天也不例外,本题是要求输出指定大小的"HDU"字符串,特别地,为了体现“正气”二字,我们要求输出的字符串也是正方形的(行数和列数相等)。
 
Input
输入的第一行包含一个正整数N(N<=20),表示一共有N组数据,接着是N行数据,每行包含一个正整数M(M<=50),表示一行内有M个“HDU”相连。
 
Output
输出指定大小的方形字符串,输出格式参见样本数据。
 
Sample Input
2
1
2
 
Sample Output
HDU
HDU
HDU
HDUHDU
HDUHDU
HDUHDU
HDUHDU
HDUHDU
HDUHDU
 
 1 #include <stdio.h>
 2 
 3 int main(){
 4     int T;
 5     int number;
 6     int i;
 7     int j;
 8     
 9     scanf("%d",&T);
10     
11     while(T--){
12         scanf("%d",&number);
13         
14         for(i=0;i<number*3;i++){
15             for(j=0;j<number;j++)
16                 printf("HDU");
17                 
18             printf("
");
19         }                        
20     }        
21     return 0;
22 }
原文地址:https://www.cnblogs.com/zqxLonely/p/4054927.html