#include<iostream> using namespace std; int main() { int t; cin >> t; while(t --) { char c; int n; cin >> c >> n; for(int i = 1;i <= n;i ++) { for(int j = 1;j <= n + i - 1;j ++) { if(j <= n - i) cout << " "; else { if(i != n) { if(j == n + i - 1 || j == n - i + 1) cout << c; else cout << " "; } else cout << c; } } if(i < n) cout << endl; } if(t > 0) cout << endl; } return 0; } |
Double click to view unformatted code.