-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuva488.cpp
51 lines (45 loc) · 898 Bytes
/
uva488.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
45
46
47
48
49
50
51
#include<iostream>
#include<vector>
using namespace std;
int main()
{
int T,a,f,i,k,m;
vector<char>vr[10000];
cin>>T;
cout<<endl;
while(T--)
{
cin>>a>>f;
for(i=1;i<=a;i++)
{
for(k=0;k<i;k++)
vr[i-1].push_back(i+48);
}
k=i-1;
for(i=k-1;i>0;i--)
{
for(m=0;m<i;m++)
vr[k].push_back(i+48);
k++;
}
while(f--)
{
for(i=0;i<(2*a)-1;i++)
{
for(k=0;k<vr[i].size();k++)
{
cout<<vr[i][k];
}
if(f==0)
vr[i].clear();
cout<<endl;
}
if(T==0&&f==0)
break;
cout<<endl;
}
/* if(T!=0)
cout<<endl;*/
}
return 0;
}