2013秋13级预备队集训练习1 I - Triangle Wave
来源:互联网 发布:网络管理工具有哪些 编辑:程序博客网 时间:2024/05/16 01:37
In this problem you are to generate a triangular wave form according to a specified pair of Amplitude and Frequency.
Input and Output
The input begins with a single positive integer on a line by itself indicating the number of the cases following, each of them as described below. This line is followed by a blank line, and there is also a blank line between two consecutive inputs.
Each input set will contain two integers, each on a separate line. The first integer is the Amplitude; the second integer is the Frequency.
For each test case, the output must follow the description below. The outputs of two consecutive cases will be separated by a blank line.
For the output of your program, you will be printing wave forms each separated by a blank line. The total number of wave forms equals the Frequency, and the horizontal ``height'' of each wave equals the Amplitude. The Amplitude will never be greater than nine.
The waveform itself should be filled with integers on each line which indicate the ``height'' of that line.
NOTE: There is a blank line after each separate waveform, excluding the last one.
Sample Input
132
Sample Output
122333221122333221#include<stdio.h>int main(){ int i , n , j , k , t , a, b; scanf("%d", &n); for(i = 1 ; i <= n ; i++) { scanf("%d%d", &a, &b); for(j = 1 ; j <= b ; j++) { for(k = 1; k <= a ; k++) { for(t = 1 ; t <= k ; t++) printf("%d", k); printf("\n"); } for(k = a-1 ; k >= 1 ; k--) { for(t = 1 ; t <= k ; t++) printf("%d", k); printf("\n"); } if(i==n && j==b); else printf("\n"); } }}
- 2013秋13级预备队集训练习1 I - Triangle Wave
- 2013秋13级预备队集训练习2 --A - Palindromes
- 2013秋13级预备队集训练习4 --B - Steps
- 2013秋13级预备队集训练习1 A - Hashmat the Brave Warrior
- 2013秋13级预备队集训练习1 B - Back to High School Physics
- 2013秋13级预备队集训练习1 C - Ecological Premium
- 2013秋13级预备队集训练习1 D - The Decoder
- 2013秋13级预备队集训练习1 E - Kindergarten Counting Game
- 2013秋13级预备队集训练习1 F - Machined Surfaces
- 2013秋13级预备队集训练习1 G - Rotating Sentences
- 2013秋13级预备队集训练习1 H - Marvelous Mazes
- 2013秋13级预备队集训练习1 J - Hangman Judge
- 2013秋13级预备队集训练习1 K - The Collatz Sequence
- 2013秋13级预备队集训练习1 L - Linear Cellular Automata
- 2013秋13级预备队集训练习3 --E - The ? 1 ? 2 ? ... ? n = k problem
- 2013秋13级预备队集训练习3--A - Power of Cryptography
- 2013秋13级预备队集训练习3--B - Ant on a Chessboard
- 2013秋13级预备队集训练习3 --C - Cube painting
- 2013秋13级预备队集训练习1 H - Marvelous Mazes
- openwrt常用功能编译选项
- django redirect
- 在ArcEngine下实现图层属性过滤的两种方法
- javabean用变量向数据库中插入记录的sql语句写法
- 2013秋13级预备队集训练习1 I - Triangle Wave
- linux设置时间
- Android开发学习之UnIty3D重力感应
- 显示系统支持的最大连接数
- 2013秋13级预备队集训练习1 J - Hangman Judge
- 在ArcEngine中调用ArcToolBox中的copyfeatures工具
- UBUNTU12.04服务器版配置dns服务器步骤
- jetbrick-template 1.1.1 发布,增强layout功能
- rsa加密字符串 的思想,,,,菜菜鸟们努力