-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTriangle_Wave.cpp
44 lines (40 loc) · 910 Bytes
/
Triangle_Wave.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//============================================================================
//problem link:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=429
// Name : Triangle_Wave.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//status :accepted
//============================================================================
#include <iostream>
using namespace std;
void printwave(int hight){
for(int i=1;i<=hight;i++){
for(int j=1;j<=i;j++){
cout<<i;
}
cout<<endl;
}
for(int i=hight-1;i>0;i--){
for(int j=0;j<i;j++){
cout<<i ;
}
cout<<endl;
}
}
int main() {
int n;
cin>>n;
while(n--){
int frequancy,hight;
cin>>hight>>frequancy;
while(frequancy--){
printwave(hight);
if(frequancy||n){
cout<<endl;
}
}
}
return 0;
}