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 ...
随机推荐
- SQLSTATE[HY000] [2002] 乱码
string(59) "SQLSTATE[HY000] [2002] ����Ŀ����������ܾ��������ӡ� " 实际意思是:SQLSTATE[HY000] [20 ...
- java随机生成字符串工具类
package aA; import java.util.ArrayList; import java.util.Arrays; import java.util.Random; /** * 字符随机 ...
- HDFS 数据节点(DataNode)
- Linux时间设置命令
1.date: 语法格式:date [-u] [-d datestr] [-s datestr] [--utc] [--universal] [--date=datestr] [--set=dates ...
- Mac下,spacy配置
pip3 install -U spacy -i http://pypi.douban.com/simple --trusted-host pypi.douban.com python3 -m spa ...
- input 输入框type='search'去掉×
input输入时,为了让ios键盘的前进会变为搜索,设置input的type='search'但是安卓输入框后面会出现个小叉,实际不需要这个× 解决办法: input[type=search]::-w ...
- TZ_14_Zuul网关_过滤器
1.Zuul作为网关的其中一个重要功能,就是实现请求的鉴权.而这个动作我们往往是通过Zuul提供的过滤器来实现的. 2.自定义过滤器实现用户登陆时需要携带一个Key才可以登陆,否则返回403 1> ...
- VMWare 下 Ubuntu 18.04 的文件共享
突然某天发现 /mnt/hgfs 下共享的文件夹没了... apt-get install open-vm-tools mkdir /mnt/hgfs vmhgfs-fuse .host:/ /mnt ...
- EL表达式如何读取一个string型的list 一个单纯的的字符串list
<c:forEach begin="0" end="${columnList.size()-1}" var="i"> ${ co ...
- NFS挂载服务具体的实施方案
1.服务器磁盘共享实施方案 第一步:安装NFS和rpc. 1. 安装nfs-utils:NFS主程序,rpcbind:PRC主程序 nfs-utils:NFS主程序,包含rpc.nfsd rpc.m ...