UVA_488:Triangle Wave

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的更多相关文章
- UVa 488 - Triangle Wave
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=s ...
- UVA 488 - Triangle Wave 水~
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...
- STM32之DAC君
如花说得好:呃呃呃.是俗话说得好:有了ADC,怎可少了DAC..我觉得奇怪.今天我开头就直奔主题了.我想了想,总结了一句话:孙悟空纵然有七十二变.无论是变成猫也好,变成狗也罢.始终还是会变回他本身.所 ...
- Zerojudge解题经验交流
题号:a001: 哈囉 背景知识:输出语句,while not eof 题号:a002: 簡易加法 背景知识:输出语句,while not eof,加法运算 题号:a003: 兩光法師占卜術 背景知识 ...
- UVA题目分类
题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics ...
- 【索引】Volume 0. Getting Started
AOAPC I: Beginning Algorithm Contests (Rujia Liu) Volume 0. Getting Started 10055 - Hashmat the Brav ...
- 2. 2A03简介
2A03简介 1.CPU 1.1 内部寄存器 1.累加寄存器A(Accumulator):8位寄存器,用于同算术逻辑单元(ALU)共同完成各种算术逻辑运算,它既为ALU提供原始操作数又担任存放ALU运 ...
- The Karplus-Strong Algorithm
本系列文章由 @YhL_Leo 出品,转载请注明出处. 文章链接: http://blog.csdn.net/yhl_leo/article/details/48730857 Karplus-Stro ...
- FFT初步代码分析和逼近曲线
FFT:快速傅里叶变换 文章从两个方面来写,一个是FFT的基础知识,也就是将时域信号转换为频域信号,另一个是合成时域信号. 将时域信号转换为频域信号 代码来源于http://bigsec.net/b5 ...
随机推荐
- 再也不怕数据丢失!阿里云RDS MySQL 8.0上线回收站功能
背景 MySQL 在生产环境使用过程中,会伴随着开发和运维人员的误操作,比如 DROP TABLE / DATABASE,这类 DDL 语句不具有可操作的回滚特性,而导致数据丢失,AliSQL 8.0 ...
- CSS3实现3D地球自转行星公转
截图效果:实际效果是动态的:地球自西向东自转,行星绕着地球公转,轨道也会转动 HTML页面代码: <!DOCTYPE html> <html lang="en"& ...
- MySQL数据库的全局锁和表锁
1.概念 数据库锁设计的初衷是处理并发问题.作为多用户共享的资源,当出现并发访问的时候,数据库需要合理地控制资源的访问规则.而锁就是用来实现这些访问规则的重要数据结构. 2.锁的分类 根据加锁的范围, ...
- session失效刷新后登录页面嵌入在iframe中的解决办法
在login页面中添加以下一段代码: var _topWin = window; while (_topWin != _topWin.parent.window) { _topWin ...
- 【P2616】 【USACO10JAN】购买饲料II Buying Feed, II
P2616 [USACO10JAN]购买饲料II Buying Feed, II 题目描述 Farmer John needs to travel to town to pick up K (1 &l ...
- Faster RCNN算法训练代码解析(3)
四个层的forward函数分析: RoIDataLayer:读数据,随机打乱等 AnchorTargetLayer:输出所有anchors(这里分析这个) ProposalLayer:用产生的anch ...
- MySQL ODBC驱动安装和配置数据源
一.MySQL的ODBC驱动下载及安装 步骤一:下载ODBC驱动安装包 1.下载地址: https://dev.mysql.com/downloads/connector/odbc/ 2.选择适合自己 ...
- 利用Microsoft.VisualBasic中TextFieldParser解析器把CSV格式倒入数据库
阅读目录 利用ODBC去操作 利用TextFieldParser操作 写了个Demo,利用Microsoft.VisualBasic这个程序集中的TextFieldParser解析器解析CSV格式的文 ...
- Excel柱状图折线图组合怎么做 Excel百分比趋势图制作教程
Excel柱状图折线图组合怎么做 Excel百分比趋势图制作教程 用excel作图时候经常会碰到做柱状图和折线图组合,这样的图一般难在折线图的数据很小,是百分比趋势图,所以经常相对前面主数据太小了,在 ...
- Springboot 创建的maven获取resource资源下的文件的两种方式
Springboot 创建的maven项目 打包后获取resource下的资源文件的两种方式: 资源目录: resources/config/wordFileXml/wordFileRecord.xm ...