fork(4) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int t,a,f;
  7. cin>>t;
  8. for (int i=0;i<t;i++)
  9. {
  10. cin>>a>>f;
  11. for (int i=0;i<f;i++)
  12. {
  13. for (int j=1;j<=a;j++)
  14. {
  15. cout<<j;
  16. for (int k=1;k<j;k++)
  17. {
  18. cout<<j;
  19. }
  20. cout<<endl;
  21. }
  22.  
  23. for (int x=a-1;x>0;x--)
  24. {
  25. cout<<x;
  26. for (int y=x;y>1;y--)
  27. {
  28. cout<<x;
  29. }
  30. cout<<endl;
  31. }
  32. if (i==f-1) continue;
  33. cout<<endl;
  34. }
  35. }
  36. }
Success #stdin #stdout 0s 2856KB
stdin
2

3
2

4
3
stdout
1
22
333
22
1

1
22
333
22
1
1
22
333
4444
333
22
1

1
22
333
4444
333
22
1

1
22
333
4444
333
22
1