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,excludingthe last one.
Sample Input
1 3 2
Sample Output
1 22 333 22 1 1 22 333 22 1
#define RUN #ifdef RUN #include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> #include <string> #include <iostream> #include <sstream> #include <map> #include <set> #include <vector> #include <list> #include <cctype> #include <algorithm> #include <utility> #include <math.h> using namespace std; #define MAXN 105 int n; int amp, fre; void printout(bool islast){ for(int k=0; k<fre; k++){ for(int i=1; i<=amp; i++){ for(int j=1; j<=i; j++){ printf("%d", i); } printf("\n"); } for(int i=amp-1; i>=1; i--){ for(int j=1; j<=i; j++){ printf("%d", i); } printf("\n"); } if(!islast){ printf("\n"); } else{ if(k!=fre-1){ printf("\n"); } } } } int main(){ #ifndef ONLINE_JUDGE freopen("488.in", "r", stdin); freopen("488.out", "w", stdout); #endif scanf("%d", &n); for(int i=0; i<n; i++){ getchar(); getchar(); scanf("%d%d", &, &fre); if(i != n-1){ printout(false); } else{ printout(true); } } } #endif
相关推荐
资源分类:Python库 所属语言:Python 资源全名:Flask-Triangle-joeflack4-0.5.6.zip 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
AD模块PCF8591 DA输出三角波(单片机的编程)
Largest-Triangle-Three-Buckets 算法的 Javascript 实现 从的包含算法的稍微修改。 这个 repo 的目的是简单地包含没有 flot 插件的算法。
开源项目-esimov-triangle.zip,▲ Triangle - Convert images to computer art with Go.
Hello-Triangle-01.zip
前端大厂最新面试题-triangle
git-like-cli.zip,git-like cli是一个基于java注释的框架,用于解析git-like命令行结构。
用java语言实现数学中所学的杨辉三角,该算法简单
sierpinski triangle MATLAB Code
triangle - 使用delaunay三角网将图像转换为计算机艺术
链接OpenGL库,绘制一个简单的图形,比如三角形和正方形
gl-triangle-strip-indexer 创建能够传递给三角形条状网格的 WebGL 元素数组的类型化数组。 var createIndices = require ( 'gl-triangle-strip-indexer' ) var createBuffer = require ( 'gl-buffer' ) var ...
thomas法求解对称三角线性方程组,简单高效
用OpenGL實現的各種三角函數分段顯示,初學OpenGL所寫的代碼。
HELLO:react-black-triangle(和 )的版本为v0.1-如果您发现此代码很简洁,可以让我知道您想在哪里查看更多文档,从而使它变得更好! react-black-triangle为您提供直接构建基于React的应用程序所需的代码和约定。...
Fitbit-Clock-Triangle:Fitbit时钟面
手写笔三角形发生器使用 Stylus 生成 CSS 三角形的小...用法 triangle(width, height, direction, color) .make-me-a-triangle-babytriangle(10px, 10px, 'bottom', #000)新产品经理 npm install stylus-triangle谢谢
% 用户可以通过确定其周期来设计各种锯齿波, % time shift, dc value, etc. 然后程序可以自动计算它的%傅里叶级数表示,并绘制其幅度谱和相位% 光谱。
OpenGL-4.6-Hello-Triangle:使用着色器的著名OpenGL“ Hello Triangle”。 它使用OpenGL 4.5功能,称为直接状态访问
Acute-Triangle:带有拼图扭曲的子弹地狱射手