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 ...
随机推荐
- Leetcode415Add Strings字符串相加
给定两个字符串形式的非负整数 num1 和num2 ,计算它们的和. 注意: num1 和num2 的长度都小于 5100. num1 和num2 都只包含数字 0-9. num1 和num2 都不包 ...
- 跟我一起做一个vue的小项目(九)
接下来我们进行的就是城市列表页面数据额动态渲染. 也是在mock数据,进行动态渲染 //city.json { "ret": true, "data":{ &q ...
- 过滤html标签的一个函数
str_replace(array(' ', '&', '"', ''', '“', '”', '—', '<', '>', '·', '…', '&'), ar ...
- PHP实现微信小程序支付完整版,可以借鉴!
本文实例为大家分享了php实现小程序支付的具体代码,供大家参考,具体内容如下 环境: tp3.2.3 + 小程序 微信支付功能开通 Step1: 下载PHP 支付SDK(下载地址) 放到Libr ...
- IO流5 --- FileReader读入数据的基本操作 --- 技术搬运工(尚硅谷)
FileReader 字符输入流 @Test public void test1(){ File file = new File("hello.txt"); FileReader ...
- spring boot定时任务解析
在SpringBoot中定时任务一般使用的是@Scheduled注解. @Scheduled 1.注解内容: @Target({ElementType.METHOD, ElementType.ANNO ...
- PHP之文件目录基础操作方法
1.文件的属性信息获取 首先文件具有类型,在linux下边,有block(块设备,如磁盘分区.CD-ROM).char(以字符为输入的设备,如键盘.打印机).dir(目录类型,目录也是文件的一种).f ...
- PHP--y2k38的解决方法已经时间格式的常用转换
y2k38又名千年虫问题,又称Uinx Millennium Bug,此漏洞将会影响到所有32位系统下用Unix时间戳整数来记录时间的PHP,及其它编程语言. 一个整型的变量所能保存的最大时间为203 ...
- selenium(2):环境搭建完成后,初步运行遇到的问题
检验是否搭建成功. . 问题一:运行时候,报错:请停用以开发者模式运行的扩展程序 出现错误如下: 原因:chromedriver的版本号过低了. 解决办法:应该安装与chrome版本对应的chrome ...
- Mac上homebrew使用
一.官方网址 Homebrew 二.目录 安装 查看帮助信息 查看版本 更新Homebrew自己 安装软件包 查询可更新的包 更新包 (formula) 清理旧版本 锁定不想更新的包 卸载安装包 查看 ...