博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
488 - Triangle Wave
阅读量:6339 次
发布时间:2019-06-22

本文共 1500 字,大约阅读时间需要 5 分钟。

Triangle Wave 

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"#include"stdlib.h"int main(){ int n,a,b,i,k,j;  scanf("%d ",&n);  while(n--)  {scanf("%d",&a);   scanf("%d",&b);   while(b--)    { for(i=1;i<=a;i++)//前半段输出;        {
for(k=0;k
0;i--)//后半段输出; {
for(k=0;k

 

转载于:https://www.cnblogs.com/www-xzpboke-com/archive/2013/02/20/2919243.html

你可能感兴趣的文章
Spring3全注解配置
查看>>
ThreadLocal真会内存泄露?
查看>>
低版本mybatis不能用PageHeper插件的时候用这个分页
查看>>
javaweb使用自定义id,快速编码与生成ID
查看>>
[leetcode] Add Two Numbers
查看>>
elasticsearch suggest 的几种使用-completion 的基本 使用
查看>>
04-【MongoDB入门教程】mongo命令行
查看>>
字符串与整数之间的转换
查看>>
断点传输HTTP和URL协议
查看>>
redis 数据类型详解 以及 redis适用场景场合
查看>>
mysql服务器的主从配置
查看>>
巧用AJAX技术,通过updatePanel控件实现局部刷新
查看>>
20140420技术交流活动总结
查看>>
SaltStack配置salt-api
查看>>
各种情况下block的类型
查看>>
ThinkPHP 3.2.x 集成极光推送指北
查看>>
js作用域链
查看>>
java中如何选择Collection Class--java线程(第3版)
查看>>
为运维人员插上腾飞更远的翅膀!
查看>>
Word 2003中编辑标记与格式标记大讨论
查看>>