PS: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.

Sample Input
3
2
Sample Output
1
22
333
22
1

1
22
333
22
1

Language:C++ 4.8.2

#include<stdio.h>
int main(void)
{
int m, n, total;
int copy_i;
scanf("%d", &total);
while(total--)
{
scanf("%d%d", &m, &n);
while(n--)
{
for(int i = ; i <= m; i++)
{
copy_i = i;
while(copy_i--)
printf("%d", i);
printf("\n");
}
for(int i = m-; i >=; i--)
{
copy_i = i;
while(copy_i--)
printf("%d", i);
printf("\n");
}
if(n) // there is a blank line after each separate waveform, excluding the last one.
printf("\n");
}
if(total) // 同上,缺少的话WA。
printf("\n");
}
return ;
} // 再PS:该题关键是格式,每两组之间两个空行,单组之内的三角波之间有一个空行。

UVA_488:Triangle Wave的更多相关文章

  1. UVa 488 - Triangle Wave

    https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=s ...

  2. UVA 488 - Triangle Wave 水~

    http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...

  3. STM32之DAC君

    如花说得好:呃呃呃.是俗话说得好:有了ADC,怎可少了DAC..我觉得奇怪.今天我开头就直奔主题了.我想了想,总结了一句话:孙悟空纵然有七十二变.无论是变成猫也好,变成狗也罢.始终还是会变回他本身.所 ...

  4. Zerojudge解题经验交流

    题号:a001: 哈囉 背景知识:输出语句,while not eof 题号:a002: 簡易加法 背景知识:输出语句,while not eof,加法运算 题号:a003: 兩光法師占卜術 背景知识 ...

  5. UVA题目分类

    题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics ...

  6. 【索引】Volume 0. Getting Started

    AOAPC I: Beginning Algorithm Contests (Rujia Liu) Volume 0. Getting Started 10055 - Hashmat the Brav ...

  7. 2. 2A03简介

    2A03简介 1.CPU 1.1 内部寄存器 1.累加寄存器A(Accumulator):8位寄存器,用于同算术逻辑单元(ALU)共同完成各种算术逻辑运算,它既为ALU提供原始操作数又担任存放ALU运 ...

  8. The Karplus-Strong Algorithm

    本系列文章由 @YhL_Leo 出品,转载请注明出处. 文章链接: http://blog.csdn.net/yhl_leo/article/details/48730857 Karplus-Stro ...

  9. FFT初步代码分析和逼近曲线

    FFT:快速傅里叶变换 文章从两个方面来写,一个是FFT的基础知识,也就是将时域信号转换为频域信号,另一个是合成时域信号. 将时域信号转换为频域信号 代码来源于http://bigsec.net/b5 ...

随机推荐

  1. Leetcode199. Binary Tree Right Side View二叉树的右视图

    给定一棵二叉树,想象自己站在它的右侧,按照从顶部到底部的顺序,返回从右侧所能看到的节点值. 示例: 输入: [1,2,3,null,5,null,4] 输出: [1, 3, 4] 解释: 先求深度,中 ...

  2. Redis源码解析:28集群(四)手动故障转移、从节点迁移

    一:手动故障转移 Redis集群支持手动故障转移.也就是向从节点发送"CLUSTER  FAILOVER"命令,使其在主节点未下线的情况下,发起故障转移流程,升级为新的主节点,而原 ...

  3. Javascript-简单的倒计时跳转页面

    <!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> ...

  4. leetcode 492-543 easy

    492. Construct the Rectangle Input: 4 Output: [2, 2] Explanation: The target area is 4, and all the ...

  5. h5文件简介

    h5文件是层次格式的第5代版本,用于存储科学数据的一种文件格式和库文件,由美国超级计算中心与应用中心研发的文件格式,用以存储和组织大规模数据. H5将文件结构简化成两个主要的对象类型: 1 数据集da ...

  6. SSM-6nginx Linux下的安装

    1.下载nginx: 官方网站: http://nginx.org/download/ 2. 要求的安装环境 yum install gcc-c++ yum -y install pcre-devel ...

  7. 转:Android检查设备是否联网

    public static boolean isConnect(Context context) { ConnectivityManager connectionManager = (Connecti ...

  8. meet-in-the-middle 基础算法(优化dfs)

    $meet-in-the-middle$(又称折半搜索.双向搜索)对于$n<=40$的搜索类型题目,一般都可以采用该算法进行优化,很稳很暴力. $meet-in-the-middle$算法的主要 ...

  9. 使用Charles在iOS6上进行抓包

    抓取Web页面的网络请求很容易,Chrome和Firefox都很容易做到.iOS APP如何抓包呢?其实也很容易,我比较喜欢使用 Charles. 我用的是Mac电脑,首先建立一个热点,然后让iOS设 ...

  10. JEECMS自定义标签开发步骤

    JEECMS自带的只有[@cms_advertising]标签,并且官方没有给文档,用法: [@cms_advertising id='3']             <img src=&quo ...